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 开发者_StackOverflow中文版then 'ready for use' when the interpreter is first started. Am I correct ?
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.
加载中,请稍侯......
精彩评论