is list comprehension necessary?

Andre Alexander Bell post at andre-bell.de
Tue Oct 26 13:07:44 EDT 2010


Hello,

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)]
>>> i
2

Regards


Andre



More information about the Python-list mailing list