How can 'type' be an instance of itself?

LittleGrasshopper seattlehanks at yahoo.com
Fri May 29 01:05:46 CEST 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 mailing list