To my great surprise, this approach was often considerably _slower_ to complete than the original program (up to ~40% depending on which modifiers were used), despite producing initial results more quickly.

You may be interested in reading through this thread

http://mail.python.org/pipermail/python-list/2008-January/473650.html

where looping vs generators were timed and you can see that generators clearly (and sadly) impose a speed penalty as demonstrated by Andrew Reedick. I'm not sure whether the "why" of it was ever determined, but generators should be used with care if speed is more important than clarity.

-tkc



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to