[Pyrex] Subclassing - design question
Helmut Jarausch
jarausch at skynet.be
Wed Mar 8 14:38:51 CET 2006
Hi,
given
cdef class B:
cdef int Seen
def __new__(self):
self.Seen=17
cdef class D(B):
def __new__(self,int DS):
.....
In Python the __init__ method of a base class must be called
explicity (similarly to the base class initialization call
in a C++ constructor)
This is necessary since the base' __init__ can be called
with different arguments.
But in Pyrex the __new__ method of the base class is automatically
called by the python runtime library, so Pyrex can only fill
ONE possible call into the PyTypeObject table.
Currently, function generate_new_function (if base_type:) of Nodes.py
just copies it's own argument list. So, IHMO, Pyrex would need a
new syntactic possiblity to let the user specify the arguments going
to the base class.
This shoe is too big for me (literal translation of a German saying)
Helmut.
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
More information about the Pyrex
mailing list