[Python-Dev] EuroPython Language Summit report

P.J. Eby pje at telecommunity.com
Mon Jun 27 03:43:49 CEST 2011

At 12:32 PM 6/25/2011 -0400, R. David Murray wrote:
>So your proposed code would allow me, when writing a generator in
>my code, do something that would allow me to yield up all the
>values from an arbitrary generator I'm calling, over which I have
>no control (ie: I can't modify its code)?

With a decorator on your own function, yes.  See:


for details.  Mostly, though, that proposal was a suggestion for how 
the "optimized" implementation would work - i.e., a suggestion that 
PEP 380 be implemented that way under the hood, by implicitly turning 
'yield from' into 'yield From()' and wrapping the generator itself 
with another From() instance.

(IOW, that was a proposal for how to avoid the extra overhead of 
recursive yielding in a series of nested yield-from's.)

More information about the Python-Dev mailing list