How can 'type' be an instance of itself?
seattlehanks at yahoo.com
Thu May 28 19:05:46 EDT 2009
This is probably trivial, but it's driving me mad somehow. All (new
style) classes are instances of 'type' by default, unless a custom
metaclass is specified. I take this to mean that when a class
declaration is found in the code, an instance of 'type' representing
that class is created by calling type.__init__. What really gets me is
how can 'type' be an instance of itself. In order to create 'type' we
would need to call type.__init__, but it seems at this point it
wouldn't exist. Probably a dumb question, which I hope someone can
explain in some detail.
More information about the Python-list