[Python-ideas] x=(yield from) confusion [was:Yet another alternative name for yield-from]

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Apr 10 02:35:14 CEST 2009

Jacob Holm wrote:

> That rules out Gregs and my patches as well.  They both need extra state 
> on the frame object to be able to implement yield-from in the first place.

But that state is obviously necessary in order to support
yield-from, and it goes away as soon as the yield-from
itself finishes.

Your proposals add non-obvious extra state that persists
longer than normally expected, to support obscure features
that will rarely be used.

> One final suggestion I have is to make yield-from raise a RuntimeError 
> if used on a generator that already has a frame.  That would ...
 > b) make it clear that the only intended
> use is with a *fresh* generator or a non-generator iterable,

But there's no way of detecting a violation of that rule
for a non-generator iterator, and I want to avoid having
special cases for generators, since it goes against duck


More information about the Python-ideas mailing list