[issue18983] Specify time unit for timeit CLI

Julian Gindi report at bugs.python.org
Tue Nov 26 23:33:40 CET 2013


Julian Gindi added the comment:

I created a patch that allows users to specify a time unit output using the "-u" flag. Example usage:

python -m timeit -u "msec" '"-".join(str(n) for n in range(100))'
>> 10000 loops, best of 3: 0.156 msec per loop

python -m timeit -u "sec" '"-".join(str(n) for n in range(100))'
>> 10000 loops, best of 3: 0.000159 sec per loop

You can specify msec, sec, or usec. I am also interested in having a JSON option as mentioned by Antoine. Any thoughts?

----------
keywords: +patch
nosy: +Julian.Gindi
Added file: http://bugs.python.org/file32862/issue18983.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18983>
_______________________________________


More information about the Python-bugs-list mailing list