[issue5577] yield in iterators
Terry J. Reedy
report at bugs.python.org
Sat Mar 28 00:29:11 CET 2009
Terry J. Reedy <tjreedy at udel.edu> added the comment:
I think this should just be closed.
The original implied claim that 3.0 is not correct is not correct. The
change of behavior is a clear side effect of and intended and documented
change in the semantics of comprehensions.
As near as I can tell, the results of the experiments are all correct
according to the doc for yield.
Python-list or the python-ideas list is more appropriate than the
tracker to discuss a semantic change. In any case, comprehensions are
function expressions, like lambda expressions, and expressions therein
should act much the same as the expression in a lambda expression.
Even if unclear, slightly insane, and not very useful, I do not think
yield should be prohibited in generators expression because
1) it would introduce a back-incompatibility in 3.1;
2) it would slightly break the parallelism with other comprehensions;
3) it would slightly break the parallelism with the expanded for-form;
4) such use is unlikely in real practice; and
5) it would raise the question of where else to prohibit yield.
----------
nosy: +tjreedy
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5577>
_______________________________________
More information about the Python-bugs-list
mailing list