[Pyrex] Calling SuperClass.__init__() ?

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Wed Apr 26 11:25:29 CEST 2006


Greg Ewing wrote:
> Stefan Behnel wrote:
>> As __init__ is a rather unambiguous special method, I think that
>> ExtensionType.__init__(...) should calls the C function directly.
> 
> Yes, it should, and the same goes for the rest of the
> typeslot methods.

Well, not only for those. It's true for any method that's called on an
extension /type/ (as opposed to instances). Note that you cannot do the same
thing for instances as you do not know what object is in them exactly, so
you'd loose inheritance. But super-class calls like

ExtensionType.__init__(self)
ExtensionType.clear(self)
ExtensionType.whatever(self, ...)

are always safe as Pyrex knows their complete inheritance structure and
therefore the exact method that is to be called. And since all methods of
extension types are implemented in C, these should all become plain C calls.

Stefan



More information about the Pyrex mailing list