summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-04-03 02:43:54 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-04-03 02:43:54 (GMT)
commit6ecb1a3145b6df2c532779902651a6913535581a (patch)
tree3dffaaf983023a2714ab5397c9ccfc3e251a5962
parent6df48a3354d5861be879b8ffed9c1eda5a0fc2c5 (diff)
downloadcpython-6ecb1a3145b6df2c532779902651a6913535581a.zip
cpython-6ecb1a3145b6df2c532779902651a6913535581a.tar.gz
cpython-6ecb1a3145b6df2c532779902651a6913535581a.tar.bz2
Localize the function lookup in timeit.
-rw-r--r--Lib/timeit.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/timeit.py b/Lib/timeit.py
index c0b0856..9054243 100644
--- a/Lib/timeit.py
+++ b/Lib/timeit.py
@@ -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