[Python-Dev] Why are there no 'set' and 'frozenset' types in the 'types' module?

Antoine Pitrou solipsis at pitrou.net
Mon Apr 25 14:52:20 CEST 2011


On Mon, 25 Apr 2011 14:04:35 +0200
haael <haael at interia.pl> wrote:
> 
> Sorry if I am asking the obvious, but why are the aliases of set types not 
> included in the 'types' module?

Because there's no reason to include them, since they are already in
the root (builtins) namespace.

You'll notice that in Python 3, the "types" module only contains types
which are not obviously accessed through easier means:

>>> dir(types)
['BuiltinFunctionType', 'BuiltinMethodType', 'CodeType', 'FrameType',
'FunctionType', 'GeneratorType', 'GetSetDescriptorType', 'LambdaType',
'MemberDescriptorType', 'MethodType', 'ModuleType', 'TracebackType',
'__builtins__', '__cached__', '__doc__', '__file__', '__name__',
'__package__']


Regards

Antoine.




More information about the Python-Dev mailing list