is list comprehension necessary?

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Fri Oct 29 23:09:28 CEST 2010


In message <mailman.264.1288112997.2218.python-list at python.org>, Andre 
Alexander Bell wrote:

>    >>> i = 5
>    >>> l = [i**2 for i in range(3)]
>    >>> i
>    2

The last line comes out as 5 in Python 3.1.



More information about the Python-list mailing list