List comprehensions performance

Raymond Hettinger vze4rx4y at
Thu Sep 30 10:30:32 CEST 2004

[Neuruss] What I'd like to know is if using list comprehensions would give me a
> performance advantage over traditional for loops or not.

For Py2.4, list comprehensions are much faster than equivalent for-loops.

> I'm getting fond of list comprehensions, but I wonder if it's wise to
> abuse of them...

Use whatever is clearest.
Don't abuse anything.

Raymond Hettinger

More information about the Python-list mailing list