[Pyrex] A couple of questions about pyrex
Yingjie Lan
lanyjie at yahoo.com
Tue May 12 14:45:40 CEST 2009
Thanks for the reply!
--- On Tue, 5/12/09, Robert Bradshaw <robertwb at math.washington.edu> wrote:
> From: Robert Bradshaw <robertwb at math.washington.edu>
> Subject: Re: [Pyrex] A couple of questions about pyrex
> To: lanyjie at yahoo.com
> Cc: pyrex at lists.copyleft.no
> 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
More information about the Pyrex
mailing list