A plea for a bugfix was Re: [Pyrex] Unlucky fellow needs help (pyrex crashes)

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 9 00:26:51 CET 2006


Helmut Jarausch wrote:

> I could benefit quite a lot from subclassing.
> But my base class __new__ takes only self as
> argument whereas my derived classes take more
> parameters.

You need to modify your base __new__ so that
it will accept additional parameters, e.g.

   cdef class B:

     def __new__(self, *args, **kwds):
       self.Seen=17

This is the best you can do with current Pyrex
since it doesn't provide any way of controlling
which parameter are passed to the base __new__.

It's a good idea to design __new__ methods this
way anyway, since it makes things easier for
Python subclassers of your class -- they only
need to override __init__ and not __new__ as
well.

Greg



More information about the Pyrex mailing list