Types missing from "types"module

Discussion in 'Python' started by John Nagle, Jun 24, 2010.

  1. John Nagle

    John Nagle Guest

    Here's dir(types), in Python 2.6.5:

    ['BooleanType', 'BufferType', 'BuiltinFunctionType',
    'BuiltinMethodType', 'ClassType', 'CodeType', 'ComplexType',
    'DictProxyType', 'DictType', 'DictionaryType', 'EllipsisType',
    'FileType', 'FloatType', 'FrameType', 'FunctionType', 'GeneratorType',
    'GetSetDescriptorType', 'InstanceType', 'IntType', 'LambdaType',
    'ListType', 'LongType', 'MemberDescriptorType', 'MethodType',
    'ModuleType', 'NoneType','NotImplementedType', 'ObjectType',
    'SliceType', 'StringType', 'StringTypes', 'TracebackType', 'TupleType',
    'TypeType', 'UnboundMethodType', 'UnicodeType', 'XRangeType',
    '__builtins__', '__doc__', '__file__', '__name__', '__package__']

    Seems to be missing SetType, FrozenSetType, BytesType, and
    ByteArrayType. Anything else missing?

    (Arguably, "bytes" isn't really distinguished until 3.x, but
    still...)

    John Nagle
    John Nagle, Jun 24, 2010
    #1
    1. Advertising

  2. Sent from my iPad

    On Jun 23, 2010, at 9:24 PM, John Nagle <> wrote:

    > Here's dir(types), in Python 2.6.5:
    >
    > ['BooleanType', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', 'ClassType', 'CodeType', 'ComplexType', 'DictProxyType', 'DictType', 'DictionaryType', 'EllipsisType', 'FileType', 'FloatType', 'FrameType', 'FunctionType', 'GeneratorType', 'GetSetDescriptorType', 'InstanceType', 'IntType', 'LambdaType', 'ListType', 'LongType', 'MemberDescriptorType', 'MethodType', 'ModuleType', 'NoneType','NotImplementedType', 'ObjectType', 'SliceType', 'StringType', 'StringTypes', 'TracebackType', 'TupleType', 'TypeType', 'UnboundMethodType', 'UnicodeType', 'XRangeType', '__builtins__', '__doc__', '__file__', '__name__', '__package__']
    >
    > Seems to be missing SetType, FrozenSetType, BytesType, and
    > ByteArrayType. Anything else missing?
    >
    > (Arguably, "bytes" isn't really distinguished until 3.x, but
    > still...)
    >
    > John Nagle
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    Stephen Hansen, Jun 24, 2010
    #2
    1. Advertising

  3. On Jun 23, 2010, at 9:24 PM, John Nagle <> wrote:

    > Here's dir(types), in Python 2.6.5:
    >
    > ['BooleanType', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', 'ClassType', 'CodeType', 'ComplexType', 'DictProxyType', 'DictType', 'DictionaryType', 'EllipsisType', 'FileType', 'FloatType', 'FrameType', 'FunctionType', 'GeneratorType', 'GetSetDescriptorType', 'InstanceType', 'IntType', 'LambdaType', 'ListType', 'LongType', 'MemberDescriptorType', 'MethodType', 'ModuleType', 'NoneType','NotImplementedType', 'ObjectType', 'SliceType', 'StringType', 'StringTypes', 'TracebackType', 'TupleType', 'TypeType', 'UnboundMethodType', 'UnicodeType', 'XRangeType', '__builtins__', '__doc__', '__file__', '__name__', '__package__']
    >
    > Seems to be missing SetType, FrozenSetType, BytesType, and
    > ByteArrayType. Anything else missing?
    >
    > (Arguably, "bytes" isn't really distinguished until 3.x, but
    > still...)


    IIUC, since Python 2.2ish you can't treat the types module as
    comprehensive. It exists as a remnant from the time when there was a
    difference between types and classes.

    Sets and the recent additions exist solely in this new world where we
    just isinstance(blah, set) or issubclass or whatnot.

    --Stephen via iPad
    Stephen Hansen, Jun 24, 2010
    #3
  4. John Nagle

    John Nagle Guest

    On 6/23/2010 10:08 PM, Stephen Hansen wrote:
    > On Jun 23, 2010, at 9:24 PM, John Nagle<> wrote:
    >
    >> Here's dir(types), in Python 2.6.5:
    >>
    >> ['BooleanType', 'BufferType', 'BuiltinFunctionType', 'BuiltinMethodType', 'ClassType', 'CodeType', 'ComplexType', 'DictProxyType', 'DictType', 'DictionaryType', 'EllipsisType', 'FileType', 'FloatType', 'FrameType', 'FunctionType', 'GeneratorType', 'GetSetDescriptorType', 'InstanceType', 'IntType', 'LambdaType', 'ListType', 'LongType', 'MemberDescriptorType', 'MethodType', 'ModuleType', 'NoneType','NotImplementedType', 'ObjectType', 'SliceType', 'StringType', 'StringTypes', 'TracebackType', 'TupleType', 'TypeType', 'UnboundMethodType', 'UnicodeType', 'XRangeType', '__builtins__', '__doc__', '__file__', '__name__', '__package__']
    >>
    >> Seems to be missing SetType, FrozenSetType, BytesType, and
    >> ByteArrayType. Anything else missing?
    >>
    >> (Arguably, "bytes" isn't really distinguished until 3.x, but
    >> still...)

    >
    > IIUC, since Python 2.2ish you can't treat the types module as
    > comprehensive. It exists as a remnant from the time when there was a
    > difference between types and classes.
    >
    > Sets and the recent additions exist solely in this new world where we
    > just isinstance(blah, set) or issubclass or whatnot.


    Ah. That makes sense.

    Does the "types" module go away in 3.x, then?

    John Nagle
    John Nagle, Jun 24, 2010
    #4
  5. John Nagle

    Ian Kelly Guest

    On Thu, Jun 24, 2010 at 12:29 AM, John Nagle <> wrote:
    >   Does the "types" module go away in 3.x, then?


    Not entirely, but it is greatly reduced.
    Ian Kelly, Jun 24, 2010
    #5
  6. On 06/24/2010 08:29 AM, John Nagle wrote:
    > On 6/23/2010 10:08 PM, Stephen Hansen wrote:
    >> On Jun 23, 2010, at 9:24 PM, John Nagle<> wrote:
    >>
    >>> Here's dir(types), in Python 2.6.5:
    >>>
    >>> ['BooleanType', 'BufferType', 'BuiltinFunctionType',
    >>> 'BuiltinMethodType', 'ClassType', 'CodeType', 'ComplexType',
    >>> 'DictProxyType', 'DictType', 'DictionaryType', 'EllipsisType',
    >>> 'FileType', 'FloatType', 'FrameType', 'FunctionType',
    >>> 'GeneratorType', 'GetSetDescriptorType', 'InstanceType', 'IntType',
    >>> 'LambdaType', 'ListType', 'LongType', 'MemberDescriptorType',
    >>> 'MethodType', 'ModuleType', 'NoneType','NotImplementedType',
    >>> 'ObjectType', 'SliceType', 'StringType', 'StringTypes',
    >>> 'TracebackType', 'TupleType', 'TypeType', 'UnboundMethodType',
    >>> 'UnicodeType', 'XRangeType', '__builtins__', '__doc__', '__file__',
    >>> '__name__', '__package__']
    >>>
    >>> Seems to be missing SetType, FrozenSetType, BytesType, and
    >>> ByteArrayType. Anything else missing?
    >>>
    >>> (Arguably, "bytes" isn't really distinguished until 3.x, but
    >>> still...)

    >>
    >> IIUC, since Python 2.2ish you can't treat the types module as
    >> comprehensive. It exists as a remnant from the time when there was a
    >> difference between types and classes.
    >>
    >> Sets and the recent additions exist solely in this new world where we
    >> just isinstance(blah, set) or issubclass or whatnot.

    >
    > Ah. That makes sense.
    >
    > Does the "types" module go away in 3.x, then?


    No, because while types like dict, int, and tuple are part of the core
    language, other types aren't directly accessible.

    >>> import types
    >>> dir(types)

    ['BuiltinFunctionType', 'BuiltinMethodType', 'CodeType', 'FrameType',
    'FunctionType', 'GeneratorType', 'GetSetDescriptorType', 'LambdaType',
    'MemberDescriptorType', 'MethodType', 'ModuleType', 'TracebackType',
    '__builtins__', '__doc__', '__file__', '__name__', '__package__']
    >>>
    Thomas Jollans, Jun 24, 2010
    #6
  7. John Nagle

    Terry Reedy Guest

    On 6/24/2010 2:29 AM, John Nagle wrote:

    > Does the "types" module go away in 3.x, then?


    No, but all the duplication (IntType is int, etc) is removed.

    >>> dir(types)

    ['BuiltinFunctionType', 'BuiltinMethodType', 'CodeType', 'FrameType',
    'FunctionType', 'GeneratorType', 'GetSetDescriptorType', 'LambdaType',
    'MemberDescriptorType', 'MethodType', 'ModuleType', 'TracebackType',
    '__builtins__', '__doc__', '__file__', '__name__', '__package__']
    --
    Terry Jan Reedy
    Terry Reedy, Jun 24, 2010
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Manlio Perillo

    missing types in module types?

    Manlio Perillo, May 29, 2004, in forum: Python
    Replies:
    0
    Views:
    341
    Manlio Perillo
    May 29, 2004
  2. Maric Michaud
    Replies:
    0
    Views:
    7,179
    Maric Michaud
    Jun 24, 2006
  3. Gary Herron
    Replies:
    2
    Views:
    653
    Bruno Desthuilliers
    Jul 4, 2006
  4. Will Gillen

    Consuming External WSD (WebReference), Missing a few types

    Will Gillen, May 7, 2008, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    164
    Will Gillen
    May 7, 2008
  5. Rick Johnson
    Replies:
    39
    Views:
    420
    Neil Cerutti
    Feb 27, 2012
Loading...

Share This Page