[Python-Dev] [SPAM: 3.000] [issue11682] PEP 380 reference implementation for 3.3

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Nov 9 11:59:09 CET 2011


Nick Coghlan wrote:
> 
> In reviewing Zbyszek's doc updates and comparing them against the Grammar, I
> discovered a gratuitous change in the implementation: it allows a bare (i.e. no
> parentheses) 'yield from' as an argument to a function.
> 
> I'll add a new test to ensure "yield from x" requires parentheses whenever
> "yield x" requires them (and fix the Grammar file on the implementation branch
> accordingly).

Wait a minute, there's nothing in the PEP as accepted that
mentions any such restriction.

My intention was that it should be as easy as possible to
replace any function call 'f(x)' with 'yield from f(x)'.
If parentheses are required, then instead of

    f(yield from g(x))

we would have to write

    f((yield from g(x)))

I can't see how this is an improvement in readability or
clarity.

-- 
Greg


More information about the Python-Dev mailing list