On 3 June 2011 19:05, Thomas Jollans <t...@jollybox.de> wrote: > On Friday 03 June 2011, it occurred to Tim Delaney to exclaim: > > > Probably the biggest savings are list creating and jumping between C- and > > > Python-functions during the map call. The lambda is a Python function, > > > which are notoriously slow to use from within map() in comparison to > > > keeping it all as C-level. Creating intermediate lists is totally > > > unnecessary and obviously a waste of time. You're actually creating 3 > > > intermediate lists - one with map(), one with zip() and one with range() > > > (the third only if this is Python 2.x code, not 3.x). > > > Actually, in Python 3, map and zip also return iterators, so I would expect > the two versions to be almost the same speed in Python 3. The Python > function call is of course still slow. >
You are of course right ... that would be a d'oh! moment for me ;) Tim Delaney
-- http://mail.python.org/mailman/listinfo/python-list