[Python-Dev] accumulator display syntax

Phillip J. Eby pje at telecommunity.com
Mon Oct 20 12:11:30 EDT 2003

At 05:45 PM 10/20/03 +0200, Alex Martelli wrote:
>On Monday 20 October 2003 04:30 pm, Guido van Rossum wrote:
> > > 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).
>Hmmm, sorry?
> >>> [.2 for .2 in range(3)]
>SyntaxError: can't assign to literal
>I think I don't understand what you mean.

He was talking about having the bytecode compiler generate "hidden" names 
for the variables...  ones that can't be used from Python.

There's one drawback there, however...  If you're stepping through the 
listcomp generation with a debugger, you won't be able to print the current 
item in the list, as (I believe) is possible now.

More information about the Python-Dev mailing list