This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Using an iteration variable outside a list comprehension needs a Py3K warning
Type: behavior Stage:
Components: Interpreter Core Versions:
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, jhylton, taicki
Priority: critical Keywords: 26backport

Created on 2008-03-17 18:20 by brett.cannon, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg63706 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2008-03-17 18:20
If you use a iteration variable from a list comprehension from outside
the list comprehension itself should raise a Py3K warning.
msg63831 - (view) Author: Taek Joo Kim (taicki) * Date: 2008-03-18 00:59
>>> i = 3
>>> [i for i in range(10)]
>>> i

In 2.6, the original value of a variable is changed by the list
comprehension. In 3.0, it is not. To fix this, we need many changes on AST.
msg84824 - (view) Author: Jeremy Hylton (jhylton) (Python triager) Date: 2009-03-31 16:19
Seemed like a good idea, but no one knew how to do it.
Date User Action Args
2022-04-11 14:56:31adminsetgithub: 46597
2009-03-31 16:19:44jhyltonsetstatus: open -> closed
resolution: wont fix
messages: + msg84824
2009-03-31 16:18:44jhyltonsetnosy: + jhylton
2008-03-18 00:59:57taickisetnosy: + taicki
messages: + msg63831
2008-03-17 20:12:00brett.cannonsetpriority: release blocker -> critical
2008-03-17 18:20:03brett.cannoncreate