[Cython] [cython-users] using generators

Robert Bradshaw robertwb at math.washington.edu
Thu Apr 28 22:32:17 CEST 2011

On Wed, Apr 27, 2011 at 11:42 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Robert Bradshaw, 27.04.2011 22:41:
>> On Wed, Apr 27, 2011 at 1:19 PM, Mad wrote:
>>> Hi list,
>>> i just read, that generators are supported in cython 0.15 - great news
>>> and brw, manny thanks. but is it somehow possible to use them with
>>> cython 0.14 too?
>>> It would be nice, if there's a patch (or the patch of  0.14 ->  0.15
>>> could be applied to the 0.14 source) to get them working,  If this is
>>> not possible,
>> No, that's not possible--there's a lot that went on between here and
>> there (it's not something you can just patch in). Any reason you're
>> trying to stick with 0.14?
>>> is 0.15 in a usable state? and how could i get it?
>> It hasn't been released yet, and the development branch (on github) is
>> relatively stable but not quite ready yet. As for the state of
>> generators, Vitja and Stefan can comment more than I can, but there
>> are still some corner cases with exception throwing that don't quite
>> work like Python, and there's also a regression with respect to inline
>> generators. I'm not sure if either of these is enough to be a blocker
>> for a release.
> Don't think they are. As you said, the exception handling is for corner
> cases (which exceptions should always be anyway) and I consider the
> behaviour "close enough" now to not be a major issue. Vitja can comment on
> this, too. The only case where I know that it currently diverges is
> exception chaining in Python 3. And that should be fixable.
> Inline generators will require some work to become usable again.
> Specifically, the expression scope that I had previously implemented for
> comprehensions (and reused for generator expressions) doesn't work with the
> then already created function scope of the generator. This needs to be fixed
> somehow, either by moving the declarations over to the expression scope or
> by directly using the function scope instead. In the latter case, it would
> also be nice to merge this with the scoped comprehensions as well.
> So, agreed that these are regressions, but certainly less important than
> getting generators and coroutines out in the wild.

OK, I've added the inline generator tests to the bug list so we can
see where we stand. I'd like to get Sage back up and compiling as
well. Any thoughts on a release timeline? Any other known

- Robert

More information about the cython-devel mailing list