is list comprehension necessary?
paul.nospam at rudin.co.uk
Tue Oct 26 19:15:01 CEST 2010
Andre Alexander Bell <post at andre-bell.de> writes:
> I occasionally use LCs, if they seem useful. However, what I don't like
> about LCs is that they 'look-like' being a closed scope, while actually
> they are in the scope of there call. Example:
>>>> i = 5
>>>> l = [i**2 for i in range(3)]
paul at sleeper-service:~$ python3
Python 3.1.2 (r312:79147, Sep 27 2010, 09:57:50)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> i = 5
>>> l = [i**2 for i in range(3)]
More information about the Python-list