convert loop to list comprehension
Steve Holden
steve at holdenweb.com
Sat Sep 9 07:21:38 EDT 2006
bvdp at xplornet.com wrote:
[...]
>
> Cool ... and damn but you guys are fast with the answers. This appears
> to work find, but in a quick and dirty test it appears that the [list]
> version takes about 2x as long to run as the original loop. Is this
> normal?
>
No hard and fast information, but as a general rue of thumb replacing
calls to a c function like list.extend() with iteration inside a list
comprehension is very likely to be slower.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
More information about the Python-list
mailing list