[ python-Bugs-1110705 ] list comprehension scope
SourceForge.net
noreply at sourceforge.net
Thu Jan 27 14:27:23 CET 2005
Bugs item #1110705, was opened at 2005-01-27 15:27
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1110705&group_id=5470
Category: Python Interpreter Core
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Simon Dahlbacka (sdahlbac)
Assigned to: Nobody/Anonymous (nobody)
Summary: list comprehension scope
Initial Comment:
The variable used for iteration in list comprehensions
is still in scope after the list comprehension.
>>>foo = [1, 2, 3]
>>>bar = [dummy + 1 for dummy in foo]
>>>dummy
3
Expected result: NameError: name 'dummy' is not defined
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1110705&group_id=5470
More information about the Python-bugs-list
mailing list