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:
http://mail.python.org/pipermail/python-dev/2010-July/102320.html
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.)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com