Rémi Lapeyre <[email protected]> added the comment:
Is this different than what you would expect?
Supplying garbage to timeit will result in an error:
>>> from timeit import timeit
>>> timeit('weofinwofinwe')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/timeit.py",
line 232, in timeit
return Timer(stmt, setup, timer, globals).timeit(number)
File
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/timeit.py",
line 176, in timeit
timing = self.inner(it, self.timer)
File "<timeit-src>", line 6, in inner
NameError: name 'weofinwofinwe' is not defined
If you want to time an empty loop, you can use:
>>> timeit('pass', number=10000)
0.0001043230000021822
----------
nosy: +remi.lapeyre
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40670>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com