Why list comprehension faster than for loop?

Xavier Ho contact at xavierho.com
Sun May 9 04:29:27 EDT 2010


On Sun, May 9, 2010 at 6:20 PM, gopi krishna <dasarathulagopi at gmail.com>wrote:

> Why list comprehension faster than for loop?
>
> Because Python optimises for certain special cases, when the number of
iterations is predicable in a list comprehension.

Cheers,
Xav
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100509/39f68428/attachment.html>


More information about the Python-list mailing list