On 10/26/2010 09:28 PM, rantingrick wrote:
On Oct 26, 12:07 pm, Andre Alexander Bell<p...@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


That (very small) issue has been fixed in Python3:

>>> l = [i**2 for i in range(3)]
>>> i
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'i' is not defined



Gary Herron



I must admit you make a good point here however the only time that
will slip you up is when you first experienced the Python LC syntax.
After a few "hello world" LC's you'll begin to love and understand
them completely.

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to