[Pyrex] metaclasses for c extension types

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Aug 8 05:25:07 CEST 2005


Simon Burton wrote:

> I see the __metaclass__ attribute is not supported for cdef classes.

> I'm wondering if this is even theoretically possible (eg. by hacking the c code).

This would be difficult, since extension types are created
a completely different way from Python classes. Instead of
calling a metaclass, the type object is statically allocated
and initialised by calling PyType_Ready.

What are you trying to accomplish with a metaclass? There
may be another way of getting the same effect.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+



More information about the Pyrex mailing list