globals in modules and inheritance from a C object
vze4rx4y at verizon.net
Mon Jan 6 15:33:20 CET 2003
> 2. Is it possible to inherit from a module. I want to directly inherit
> one of my C custom objects. The only way I can see to do this currently is
> to create a python proxy object that contains a C object and the overload
> the get/set attr methods so that it correctly sends the requests to the C
> object? Is there a better way around this? It seems a bit of a waste...
Yes. For a worked out example, look in the current CVS for
Be sure to include Py_TPFLAGS_BASETYPE in the tp_flags slot
and to create your object with self = (YourObject *)type->tp_alloc(type, 0);
instead of the usual PyObject_New.
More information about the Python-list