[issue23552] Have timeit warn about runs that are not independent of each other
Serhiy Storchaka
report at bugs.python.org
Tue Mar 17 23:43:54 CET 2015
Serhiy Storchaka added the comment:
Here is a patch that emits a warning using the warnings module. The warning is output to stderr and can be suppressed with the -Wignore option, as all other warnings.
$ ./python -m timeit -n1 -r 10 -s "import time, random" -- "time.sleep(random.random())"
1 loops, best of 10: 79.6 msec per loop
:0: UserWarning: These test results likely aren't reliable. The worst
time was more than four times slower than the best time.
$ ./python -Wignore -m timeit -n1 -r 10 -s "import time, random" -- "time.sleep(random.random())"
1 loops, best of 10: 16.2 msec per loop
----------
Added file: http://bugs.python.org/file38532/timeit_python_warning.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23552>
_______________________________________
More information about the Python-bugs-list
mailing list