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.

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

Reply via email to