[Python-Dev] PEP 380 (yield from a subgenerator) comments

P.J. Eby pje at telecommunity.com
Sat Mar 28 14:39:02 CET 2009


At 06:52 AM 3/28/2009 -0500, Guido van Rossum wrote:
> > 2. In addition to the "yield from" syntax for delegating to a
> > subgenerator, also add new syntax for returning values from
> > subgenerators so that the basic "return X" can continue to trigger
> > SyntaxError.
> >
> > Since option 2 would most likely lead to a bikeshed discussion of epic
> > proportions, I'm currently a fan of option 1 ;)
>
>Me too. It also seems option 2 doesn't help us decide what it should
>do: I still think that raising StopIteration(value) would be
>misleading to vanilla users of the generators.

Agreed.  (I still think new syntax is a plus, though, as it helps to 
clearly signal both the intent to make the generator a "subtask" and 
the need to call it with yield-from.  Readability counts.)



More information about the Python-Dev mailing list