[Python-Dev] listcomps vs. for loops

Jeremy Hylton jeremy at alum.mit.edu
Wed Oct 29 16:23:57 EST 2003


On Mon, 2003-10-20 at 14:08, Guido van Rossum wrote:
> > What I remember you saying was that it was an unfortunate but necessary
> > consequence so that it would work the same as
> > 
> >     L = []
> >     for x in R:
> >         L.append(x)
> >     print x
> > 
> > You didn't want to have different semantics for two such similar
> > constructs ("there's only one way").  You also didn't want to push a
> > stack frame for listcomps.
> 
> Then I guess I *have* changed my mind.  I guess I didn't think of the
> renaming solution way back when.

Not to make a big deal out of it, but I just checked on the first report
of this problem that I remember.  David Beazley reported this problem on
python-dev a couple of years ago and suggested the renaming solution.
http://mail.python.org/pipermail/python-dev/2001-May/015089.html

I'm sure we talked about the problem, but since I was talking I probably
said something about a nested scopes solution <0.3 wink>.  In that
thread, Tim did some effective channeling and said the day you approved
a solution based on lambda was the day you'd kill us all.

Jeremy





More information about the Python-Dev mailing list