is list comprehension necessary?

Ian Kelly ian.g.kelly at gmail.com
Tue Oct 26 13:22:57 EDT 2010


On Tue, Oct 26, 2010 at 11:07 AM, Andre Alexander Bell
<post at andre-bell.de>wrote:

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

This has been corrected in Python 3.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20101026/296010c2/attachment-0001.html>


More information about the Python-list mailing list