[Python-ideas] Yield-From: Finalization guarantees

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 1 09:23:00 CEST 2009

Guido van Rossum wrote:

> BTW, I'd really like it if you (and others interested in PEP 380) read
> Dave Beazley's excellent coroutines tutorial
> (http://dabeaz.com/coroutines/), and commented on how yield-from can
> make his example code easier to write or faster.

The place where yield-from enters the picture would
be in Part 8 ("The Problem with the Stack"), where
it would eliminate the need for the scheduler to do
trampolining of calls and returns.

The idea of yield being like a system call is an
interesting perspective. Imagine what it would be like
if ordinary programs had to make system calls every
time they wanted to call or return from a function!
That's the situation we have now when using generators
as coroutines, and it's the problem that yield-from


More information about the Python-ideas mailing list