timeit unit select breaks with >= 1000second duration
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
IPython |
Fix Committed
|
Medium
|
Unassigned |
Bug Description
[Note - fperez: Reported by David Warde-Farley, patch is his; don't forget to credit in commit log when applying]
This is a minor concern since I don't know how many people use timeit for things that take more than a few seconds but I noticed that if you have a function that runs for say, 1000 seconds, the code in Magic.py fails since 'order' gets a negative number. Thus you get something like 1.0e12 nanoseconds being printed, which is kind of silly.
Attached is a patch that fixes it in the simplest way possible: if best is >= 1000 then just use seconds, e.g.
In [16]: %timeit -n 1 -r 1 time.sleep(1000)
1 loops, best of 1: 1e+03 s per loop
See here for further details:
http://
Thanks David! Pushed to 0.10.1 (r1236) and trunk (r1258).