[Python-checkins] r71079 - python/branches/py3k/Lib/timeit.py

raymond.hettinger python-checkins at python.org
Fri Apr 3 04:45:36 CEST 2009


Author: raymond.hettinger
Date: Fri Apr  3 04:45:36 2009
New Revision: 71079

Log:
Localize the function lookup in timeit.



Modified:
   python/branches/py3k/Lib/timeit.py

Modified: python/branches/py3k/Lib/timeit.py
==============================================================================
--- python/branches/py3k/Lib/timeit.py	(original)
+++ python/branches/py3k/Lib/timeit.py	Fri Apr  3 04:45:36 2009
@@ -92,11 +92,11 @@
 
 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


More information about the Python-checkins mailing list