PEP 255: Simple Generators

Neil Schemenauer nas at python.ca
Tue Jun 19 18:21:28 EDT 2001


Denys Duchier wrote:
> Unless I misread the PEP, the entire generation logic must be
> defined in a single function (because the `yield' keyword must
> statically occur within the body of the generator function).

That's right.  These are "Simple Generations".  Implementating
continuations is much harder since you have to deal with the C
stack.  Look at Stackless Python if your interested.

I'm still hoping that Python will get continuations (microthreads
and coroutines if you think continuations is a dirty word).  Its
not going to be easy though and I feel pretty safe predicting
that they won't be in Python 2.2.  PEP 255, on the other hand,
stands a good chance of making it.

  Neil




More information about the Python-list mailing list