[Pyrex] cdef'd classes initialization

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Aug 11 01:48:03 UTC 2006


Daniele Varrazzo wrote:

> I refactored my classes splitting what required to create a viewer in 
> the __new__() method and what required to build an owner in __init__().

That's fine, but you're not avoiding all of the Python
call overhead that way. You still need to build a Python
argument tuple to pass to the __new__ method.

Also, keep in mind that interpreted code can bypass
the __init__ method in the same way, by calling the
__new__ method of the type. So your technique is not
completely crash-proof, although it would require
going out of your way a little to provoke one.

--
Greg



More information about the Pyrex mailing list