Alex Rivera | Logout

python 3 types module

Asked 2012-07-16T10:08:56.097
12

Why is the types module in Python 3 so small?

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
Edit
Report

1 Answer

16

In Python 3.x, the types module removed all types that are already accessible via easier means like the builtin namespace. For example, you will see that ListType and IntType have been removed because you can simply access them via list and int respectively.

answered 2012-07-16T10:23:08.100

Your Answer