Re: A couple of questions about pyrex
Yingjie Lan <[email protected]> Tue, 12 May 2009 05:45:40 -0700 (PDT)
| Newsgroups | gmane.comp.python.pyrex |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the reply! --- On Tue, 5/12/09, Robert Bradshaw <[email protected]> wrote: > From: Robert Bradshaw <[email protected]> > Subject: Re: [Pyrex] A couple of questions about pyrex > To: [email protected] > Cc: [email protected] > Date: Tuesday, May 12, 2009, 4:04 PM > 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. That's so simple! Love it. > > > 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. I see. But would not pyrex be able to tell which is which even if the same simple syntax is used? yingjie