Moving to functional programming
tjreedy at udel.edu
Wed Jul 16 08:32:13 CEST 2008
Ben Finney wrote:
> Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
>> I don't like square-bracket listcomps because they leak the index
>> variables to the outside.
> According to PEP 289 <URL:http://www.python.org/dev/peps/pep-0289>,
> this is an acknowledged wart that will be fixed in Python 3.0.
>>> a=[i for i in range(5)]
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
NameError: name 'i' is not defined
More information about the Python-list