我对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) 任何人都可以解释为什么在这种情况下python内置buinction all返回?Trueall([])
In [33]: all([])
Out[33]: True
In [34]: all([0])
Out[34]: False
In [35]: __builtins__.all([])
Out[35]: True
Run Code Online (Sandbox Code Playgroud)