Integer From A Float List?!?
Michael Hoffman
cam.ac.uk at mh391.invalid
Sat Mar 5 05:43:51 EST 2005
Peter Otten wrote:
> From the "Evil Coder's Guide to Fast Code":
>
> [...]
>
> $ py24 -m timeit -s "floats = map(float, range(1000))" -s"from itertools
> import starmap, izip" "ints = list(starmap(int, izip(floats)))"
> 1000 loops, best of 3: 343 usec per loop
Truly evil. Why is that faster than "ints = list(imap(int, floats))"?
It is on my system.
--
Michael Hoffman
More information about the Python-list
mailing list