Using alternative PyObject* in dynamically created classes

Jacek Generowicz jacek.generowicz at cern.ch
Wed Nov 24 08:24:58 EST 2004


Ronald Oussoren <ronaldoussoren at mac.com> writes:

> Do you want to create those classes in Python, or from your extension
> module?

Both actually.

> If you create the class in C its easy to add a hidden slot.

If you create the class statically. I need to be able to create them
dynamically, by calling type.__new__.

Anyway, the way forward seems to be to create a base class with the
appropriate slot, and dynamically create subclasses of it, as Thomas
suggested. type_new adds some slots to whatever it finds in the
superclass' tp_basicsize.



More information about the Python-list mailing list