Re: A couple of questions about pyrex
Robert Bradshaw <[email protected]> Tue, 12 May 2009 05:04:13 -0700
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Message-ID | <[email protected]> |
On May 12, 2009, at 4:53 AM, Yingjie Lan wrote: > Hi there, > > Just came to know pyrex, read the docs at pyrex homepage, and > thought about using it for my project, but have a couple of > unresolved questions. Help would be very much appreciated. > > 1) Does pyrex support writing iterator classes for collection > objects? If it does, how? Yes, simply create a class with a __next__ method. > 2) I found it not very intuitive to have exportable function > definition use the 'def' syntax, which mimics the python > counterpart, while the extension classes (cdef class) use something > different than the counterpart in python (class). Is there a > particular reason for this? Why not just use 'class MyClass' syntax > for pyrex to define an extension? You can think of "cdef" as meaning "c definition." The reason to have both is because one can have normal (non-cdef) classes as well as extension types in the same file. - Robert