python 3.1 - DictType不是类型模块的一部分?

hyp*_*r_w 5 python python-3.x

这是我在Windows上安装Python 3.1时发现的.

我在哪里可以找到其他类型,特别是DictType和StringTypes?

>>> print('\n'.join(dir(types)))
BuiltinFunctionType
BuiltinMethodType
CodeType
FrameType
FunctionType
GeneratorType
GetSetDescriptorType
LambdaType
MemberDescriptorType
MethodType
ModuleType
TracebackType
__builtins__
__doc__
__file__
__name__
__package__
>>> 
Run Code Online (Sandbox Code Playgroud)

ken*_*ytm 7

根据该types模块的文档(http://docs.python.org/py3k/library/types.html),

此模块定义了标准Python解释器使用的某些对象类型的名称,但未公开为像int或类似的内置str类型....

典型用途是用于isinstance()issubclass()检查.

由于可以使用字典类型dict,因此不需要在该模块中引入这种类型.

>>> isinstance({}, dict)
True
>>> isinstance('', str)
True
>>> isinstance({}, str)
False
>>> isinstance('', dict)
False
Run Code Online (Sandbox Code Playgroud)

(这些示例intstr已经过时了.)