views:

36

answers:

1

Reading: http://www.python.org/download/releases/2.2/descrintro/#metaclasses

A class statement is executed and then the name, bases, and attributes dict are passed to a metaclass object. Since 'type' is an instance - isinstance(type, type), it is an object already. When/how is the very first instance created ?

My guess is that the first instance was created by the core C code and is then 'ready for use' when the interpreter is first started. Am I correct ?

A: 

For all intents and purposes, the object and type objects are created during interpreter startup, yes. In practice, in CPython, parts of the two objects are allocated statically, and parts are allocated during Python startup.

Thomas Wouters