yield_all needed in Python
Douglas Alan
nessus at mit.edu
Wed Mar 2 14:40:52 EST 2005
Nick Coghlan <ncoghlan at iinet.net.au> writes:
> If you do write a PEP, try to get genexp syntax supported by the
> yield keyword.
> That is, the following currently triggers a syntax error:
> def f():
> yield x for x in gen1(arg)
Wouldn't
yield *(x for x in gen1(arg))
be sufficient, and would already be supported by the proposal at
hand?
Also, with the syntax you suggest, it's not automatically clear
whether you want to yield the generator created by the generator
expression or the values yielded by the expression. The "*" makes
this much more explicit, if you ask me, without hindering readability.
|>oug
More information about the Python-list
mailing list