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
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/__