[Python-ideas] Yet another alternative name for yield-from

Nick Coghlan ncoghlan at gmail.com
Wed Apr 1 13:45:10 CEST 2009

Greg Ewing wrote:
> I've just thought of another possible alternative
> name for yield-from:
>   y = gcall f(x)

However, you would lose the common mnemonic with yield for both turning
the current function into a generator and indicating to the reader that
the current frame may get suspended at a particular point.

While using 'yield from' obscures the new 'generator calling' aspect of
the new expression, it maintains the use of yield to indicate both "this
is a generator" and "this frame may get suspended here for an
arbitrarily long period of time".

"'yield from' is like calling a generator" may be a slightly odd
spelling of the concept, it is at least still memorable and fairly easy
to learn - while you aren't likely to guess all the details of what it
does a priori, you're unlikely to forget what it does after you have
learnt it the first time. That strikes me as a much better option than
asking everyone to learn new rules for what can turn a normal function
into a generator.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-ideas mailing list