This is what I found in my install of Python 3.1 on Windows.
Where can I find other types, specifically DictType and StringTypes?
>>> print('\n'.join(dir(types)))
BuiltinFunctionType
BuiltinMethodType
CodeType
FrameType
FunctionType
GeneratorType
GetSetDescriptorType
LambdaType
MemberDescriptorType
MethodType
ModuleType
TracebackType
__builtins__
__doc__
__file__
__name__
__package__
>>>
According to the doc of the types
module (http://docs.python.org/py3k/library/types.html),
This module defines names for some object types that are used by the standard Python interpreter, but not exposed as builtins like
int
orstr
are. ...Typical use is for
isinstance()
orissubclass()
checks.
Since the dictionary type can be used with dict
, there is no need to introduce such a type in this module.
>>> isinstance({}, dict)
True
>>> isinstance('', str)
True
>>> isinstance({}, str)
False
>>> isinstance('', dict)
False
(The examples on int
and str
are outdated too.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With