Re: Why variable used in list comprehension available outside?

2012-05-02 Thread Tim Chase
On 05/02/12 19:52, Peng Yu wrote: > The following example demonstrates the variable 'v' used in the > list comprehension is accessible out site the list > comprehension. It did in Python 2.x but has been fixed in 3.x: tim@bigbox:~$ python3 Python 3.1.3 (r313:86834, Nov 28 2010, 10:01:07) [GCC 4.4

Why variable used in list comprehension available outside?

2012-05-02 Thread Peng Yu
Hi, The following example demonstrates the variable 'v' used in the list comprehension is accessible out site the list comprehension. I think that 'v' should be strictly local. Does anybody know where this behavior is documented and why it is designed this way? ~/linux/test/python/man/library/__