[Pyrex] overriding C method and calling the super implementation

Jiba jiba at tuxfamily.org
Thu Dec 25 17:34:31 CET 2003


Hi,

I can override C method in derived extension types, but how can the
overriding method call the super implementation ?
I've tried the following (which is the Python way for that) but it
complain at runtime :
Exception exceptions.AttributeError: "type object 'bug.Parrot' has no
attribute 'describe'" in 'bug.Norwegian.describe' ignored

--8<--------------------------------------

cdef class Parrot:
  cdef void describe(self):
    print "This parrot is resting."

cdef class Norwegian(Parrot):
  cdef void describe(self):
    Parrot.describe(self)
    print "Lovely plumage!"


cdef Parrot p1, p2
p1 = Parrot()
p2 = Norwegian()
p1.describe()
p2.describe()

--8<--------------------------------------

Jiba




More information about the Pyrex mailing list