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

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Mar 27 06:00:44 CET 2009


P.J. Eby wrote:
> In particular, it should explain why these choices are so costly as to 
> justify new syntax and a complex implementation:

If avoiding trampolines was the only reason for
yield-from, that mightn't be enough justification
on its own. But it addresses several other use
cases as well. The justification for yield-from is
the total of all those.

> * decorator clearly identifying intent to create a task vs. no 
> indication of task-ness

Currently the only indication that a function is a
generator rather than an ordinary function is the
presence of a 'yield' buried somewhere in the body.
Some people complained about that back when generators
were being designed, but we seem to have gotten used
to it. I don't anticipate any worse problem here.

-- 
Greg


More information about the Python-Dev mailing list