2014-09-23 21:50:00 |
Brian Warner |
description |
With pyflakes-0.8.1 and python-2.7.8, the following test program gets the
expected complaint:
import foo
foo()
def bar():
a = 0
#a = [1 for foo in []]
for foo in []:
pass
del a
pyflakes t.py
t.py:6: import 'foo' from line 1 shadowed by loop variable
But if you uncomment the list comprehension, the pyflakes complaints go away.
I think the presence of the list comprehension should actually *increase* the
number of complaints: "foo" is being shadowed in both the list comprehension
and the for-loop. |
With pyflakes-0.8.1 and python-2.7.8, the following test program gets the expected complaint:
import foo
foo()
def bar():
a = 0
#a = [1 for foo in []]
for foo in []:
pass
del a
pyflakes t.py
t.py:6: import 'foo' from line 1 shadowed by loop variable
But if you uncomment the list comprehension, the pyflakes complaints go away.
I think the presence of the list comprehension should actually *increase* the number of complaints: "foo" is being shadowed in both the list comprehension and the for-loop. |
|