[Pyrex] (no subject)

Greg Ewing greg at cosc.canterbury.ac.nz
Tue May 27 00:27:40 CEST 2003


Alexander A Naanou <alex_nanou at pochtamt.ru> wrote:

>   I seem to have run into a problem. what I need is an *entity*
> to wrap an object in such a way as to overload several special
> methods in the wrapped object
> 
> 1) does Pyrex provide a way to control the LL object/class 
> creation (some thing similar to pythons __new__ simanticly)?

No, and I can't see any safe way of doing that. It's
vitally important that the C layout of the allocated
struct matches what the C methods in the type object
expect, and the only way to guarantee that is to use
the tp_alloc of the same type object to allocate it.

> 2) there appear to be several problems regarding the metaclasses, 
> that is if I use the pyrex extension type as a meta class the mro 
> gets all messed up in the classes object

I don't know what you mean by that. I can't think of
any reason offhand why an extension type shouldn't in
general be usable as a metaclass, as long as it
follows the appropriate protocol. 

Or do you mean that it's your own manipulation of the
MRO that doesn't work the same way when the metaclass is
an extension type? Can you elaborate?

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




More information about the Pyrex mailing list