comprehensions was Re: Switch statements again
Erik Max Francis
max at alcyone.com
Fri Jan 17 07:05:09 EST 2003
Ville Vainio wrote:
> Of course, there is still the embarrassing issue of the list
> comprehension variable not being local to the list comprehension. Why,
> oh why won't people pre-deprecate it... at least in the documentation.
> Any hope to get it into the tutorial/lang reference for 2.3 :)?
Probably for the same reason that other iterative constructs that
introduce variables don't make them local to that structure either:
>>> [x for x in range(10)]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> x
9
>>> for y in range(10): print y,
...
0 1 2 3 4 5 6 7 8 9
>>> y
9
If one annoys you, surely the other would, too?
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ I am a gentlemen: I live by robbing the poor.
\__/ George Bernard Shaw
Kepler's laws / http://www.alcyone.com/max/physics/kepler/
A proof of Kepler's laws.
More information about the Python-list
mailing list