Generator expressions v/s list comprehensions

Raymond Hettinger python at rcn.com
Tue Aug 31 18:34:30 EDT 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.


Raymond



More information about the Python-list mailing list