Generator expressions v/s list comprehensions

Raymond Hettinger python at
Wed Sep 1 00:34:30 CEST 2004

[Mahesh Padmanabhan]
> Now I see that generator expressions have been added to the language 
> with 2.4 and I question the need for it. I know that it allows for lazy 
> evaluation which speeds things up for larger lists but why was it 
> necessary to add it instead of improving list comprehension? 

FWIW, we improved list comprehensions too.  They run much faster now.


More information about the Python-list mailing list