Class construction

Demian Brecht demianbrecht at gmail.com
Mon Oct 21 11:08:25 EDT 2013


Hi all,

I'm trying to wrap my head around how classes are constructed at the
interpreter level (as a side effect of digging into metaclasses) and
I'm hoping to have my investigation either validated or ridiculed ;)

The pipeline that I've figured through some gdb debugging (starting at
type_call):

+ type_call
  + is there a metaclass for this object?
    + return metaclass->tp_new
  + roughly 350 LOC constructing the type
  + is object is not a subclass of type?
     + return object
   + call obj->tp_init

Does that sound correct? My C/gdb skills are horribly rusty at this
point so expert insight would help :)

Thanks,

-- 

Demian Brecht
http://demianbrecht.github.com



More information about the Python-list mailing list