[Pyrex] Small addition to the FAQ
Conrad Steenberg
conrad at hep.caltech.edu
Thu Aug 12 17:57:56 CEST 2004
Hi
Since I struggled a little with this last night, here is a proposed FAQ
addition - basically a corollary to the last FAQ entry on
http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/version/Doc/FAQ.html
-----
Q: Pyrex says my extension type object has no method 'eat':
cdef class Vegetables:
cdef int rhubarb
cdef eat(self):
munch(self.rhubarb)
A: The method is not declared as a Python object and is not
automatically added to the class attribute list. See
http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/version/Doc/overview.html#Footnote2
To make the method callable from outside the class definition, define
the method using 'def' instead of 'cdef'.
Conversely, this scope rule may be used to hide methods from outside
code when needed.
-----
Is this correct?
Btw, Pyrex has already saved me days, if not weeks, of coding time. I
used it in bindings for an AVL tree library and SAMBA's tdb, both of
which are in production in a Python-based web service framework
(clarens.sf.net). Thanks!
Cheers
Conrad
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Conrad Steenberg
[conrad at hep.caltech.edu]
No matter where I go, the place is always called "here".
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3740 bytes
Desc: not available
Url : http://lists.copyleft.no/pipermail/pyrex/attachments/20040812/42d1ad83/smime.bin
More information about the Pyrex
mailing list