[Python-Dev] listcomps vs. for loops

Aahz aahz at pythoncraft.com
Mon Oct 20 13:31:35 EDT 2003


On Mon, Oct 20, 2003, Guido van Rossum wrote:
>Alex Martelli:
>>
>> We are indeed sure (sadly) that list comprehensions leak control variable 
>> names.
> 
> But they shouldn't.  It can be fixed by renaming them (e.g. numeric
> names with a leading dot).

?!?!  When listcomps were introduced, you were strongly against any
changes that would make it difficult to switch back and forth between a
listcomp and its corresponding equivalent for loop.  Are you changing
your position or are you suggesting that for loops should grow private
names?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan



More information about the Python-Dev mailing list