"Keith Goodman" <[EMAIL PROTECTED]> writes: > On 8/9/07, Gary Ruben <[EMAIL PROTECTED]> wrote: >> FWIW, >> The list comprehension is faster than using map() >> >> In [7]: %timeit map(lambda x:x[0],bounds) >> 10000 loops, best of 3: 49.6 -¦s per loop >> >> In [8]: %timeit [x[0] for x in bounds] >> 10000 loops, best of 3: 20.8 -¦s per loop > > zip is even faster on my computer: > >>> timeit map(lambda x:x[0], bounds) > 100000 loops, best of 3: 5.48 µs per loop >>> timeit [x[0] for x in bounds] > 100000 loops, best of 3: 2.69 µs per loop >>> timeit a, b = zip(*bounds) > 100000 loops, best of 3: 2.57 µs per loop
itertools.izip is faster yet on mine. _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion