[Python-Dev] accumulator display syntax

Guido van Rossum guido at python.org
Mon Oct 20 10:30:37 EDT 2003


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

> We can hardly be sure of what iterator comprehensions would be
> defined to do, given they don't exist, but surely we can HOPE that
> in an ideal world where iterator comprehensions were part of Python
> they would not be similarly leaky:-).

It's highly likely that the implementation will have to create a
generator function under the hood, so they will be safely contained in
that frame.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list