Moving to functional programming

Terry Reedy 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.

Has been.
IDLE 3.0b1
 >>> a=[i for i in range(5)]
 >>> i
Traceback (most recent call last):
   File "<pyshell#1>", line 1, in <module>
     i
NameError: name 'i' is not defined




More information about the Python-list mailing list