mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Localize the function lookup in timeit.
This commit is contained in:
parent
85737b875f
commit
b646aa1789
1 changed files with 2 additions and 2 deletions
|
@ -92,11 +92,11 @@ def reindent(src, indent):
|
|||
|
||||
def _template_func(setup, func):
|
||||
"""Create a timer function. Used if the "statement" is a callable."""
|
||||
def inner(_it, _timer):
|
||||
def inner(_it, _timer, _func=func):
|
||||
setup()
|
||||
_t0 = _timer()
|
||||
for _i in _it:
|
||||
func()
|
||||
_func()
|
||||
_t1 = _timer()
|
||||
return _t1 - _t0
|
||||
return inner
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue