rantingrick <rantingr...@gmail.com> writes: > Python map is just completely useless. [...]
>>>> import time >>>> def test1(): > l = range(10000) > t1 = time.time() > map(lambda x:x+1, l) > t2= time.time() > print t2-t1 >>>> def test2(): > l = range(10000) > t1 = time.time() > for x in l: > x + 1 > t2 = time.time() > print t2-t1 > >>>> test1() > 0.00200009346008 >>>> test2() > 0.000999927520752 >>>> def test3(): Well, not building the resulting list saves some time. But even if you do r.append(x+1) map appears to be slower... Try this: def test3(): l = range(10000) t1 = time.time() [ x+1 for x in l] t2 = time.time() print t2-t1 I've not used map since I learned about list comprehensions. -- Alain. -- http://mail.python.org/mailman/listinfo/python-list