removing list comprehensions in Python 3.0

Steven Bethard steven.bethard at gmail.com
Sun Jul 10 03:32:11 CEST 2005


Raymond Hettinger wrote:
> The root of this discussion has been the observation that a list
> comprehension can be expressed in terms of list() and a generator
> expression.

As George Sakkis already noted, the root of the discussion was actually 
the rejection of the dict comprehensions PEP.

> However, the former is faster when you actually want a list result

I would hope that in Python 3.0 list comprehensions and generator 
expressions would be able to share a large amount of implementation, and 
thus that the speed differences would be much smaller.  But maybe not...

> and many people (including Guido) like the square brackets.
                                ^
                                |
This --------------------------+ of course, is always a valid point. ;)

STeVe



More information about the Python-list mailing list