[Pyrex] is cdef __init__ allowed?
Robin Becker
robin at reportlab.com
Sun Dec 21 14:21:18 CET 2003
OK this slight modification of the standard example works, but if I
change def __init__(self,i): into cdef __init__(self, int i): I get the
error I mentioned in the last post ie
ttt.c(402) : error C2065: 'None' : undeclared identifier
so are cdef special methods allowed?
###########################################
cdef class Parrot:
cdef int i
def __init__(self, i):
self.i = i
cdef void describe(self):
print "This parrot is resting."
cdef class Norwegian(Parrot):
cdef void describe(self):
print "Lovely plumage!"
cdef Parrot p1, p2
p1 = Parrot(1)
p2 = Norwegian(2)
p1.describe()
p2.describe()
print p1.i, p2.i
###########################################
--
Robin Becker
More information about the Pyrex
mailing list