Changes by Terry J. Reedy tjre...@udel.edu:
--
superseder: - yield expression inside generator expression does nothing
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue3267
___
New submission from Erick Tryzelaar [EMAIL PROTECTED]:
This may be a known consequence of python 3.0, but I couldn't find any
reference to it, nor a test case that covers it. Here's a valid use of yield
in 2.5.1:
def foo():
... x=[(yield x) for x in 1,2,3]
... yield 5
... yield x
Benjamin Peterson [EMAIL PROTECTED] added the comment:
This is because list comprehensions are implemented as functions in 3.0
so their scope is not leaked out to the rest of the function.
Here is the bytecode for 2.6:
dis.dis(f)
2 0 BUILD_LIST 0
3
Brett Cannon [EMAIL PROTECTED] added the comment:
Yes, this change in semantics is expected. Closing as won't fix.
--
nosy: +brett.cannon
resolution: - wont fix
status: open - closed
___
Python tracker [EMAIL PROTECTED]