[IPython-dev] [patch] timeit unit select breaks with >= 1000second duration

David Warde-Farley dwf@cs.toronto....
Sat Jul 4 16:48:23 CDT 2009


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

Regards,

David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: duration-patch.diff
Type: application/octet-stream
Size: 528 bytes
Desc: not available
Url : http://mail.scipy.org/pipermail/ipython-dev/attachments/20090704/c26ba95b/attachment.obj 
-------------- next part --------------





More information about the IPython-dev mailing list