[Python-ideas] Yield-From Example 2: Scheduler

Adam Olsen rhamph at gmail.com
Fri Feb 20 02:33:20 CET 2009

On Thu, Feb 19, 2009 at 6:04 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> So there perhaps isn't a very strong case for using 'yield
> from' in a scheduler setting. However it still illustrates
> the utility of being able to return a value from a generator,
> since otherwise you would either have to explicitly raise
> the StopIteration or resort to some convention such as
> yield Call(g)/yield Return(x).

If you can propose semantics for return that don't risk silently
eating values then I'll at least gives -0.  Until then I'm -1.

> In a wider setting, I still think there is benefit in
> being able to abstract out pieces of generator code
> without needing to have a special driver.

Microthreads need the special driver anyway, to handle all the other
kinds of resources.

Adam Olsen, aka Rhamphoryncus

More information about the Python-ideas mailing list