Python (2 only?) looks at the value of variable __metaclass__
to determine how to create a type
object from a class definition. It is possible to define __metaclass__
at the module or package level, in which case it applies to all subsequent class definitions in that module.
However, I encountered the following in the flufl.enum
package's __init__.py
:
__metaclass__ = type
Since the default metaclass if __metaclass__
is not defined is type
, wouldn't this have no effect? (This assignment would revert to the default if __metaclass__
were assigned to at a higher scope, but I see no such assignment.) What is its purpose?