Vol*_*nko 10 python python-3.x
我对python 2.X和python 3.X之间的区别有一点疑问.为什么在python 3类型模块中这么小?日Thnx
Python 2.7
>>> import types
>>> print(len([i for i in dir(types) if not i.startswith('__')]))
37
Python 3.2
>>> import types
>>> print(len([i for i in dir(types) if not i.startswith('__')]))
12
Run Code Online (Sandbox Code Playgroud)
ToB*_*ced 13
在Python 3.x中,types模块通过内置命名空间等更简单的方法删除了所有已经可访问的类型.例如,您将看到ListType并IntType已被删除,因为您可以分别通过list和int分别访问它们.
| 归档时间: |
|
| 查看次数: |
5533 次 |
| 最近记录: |