[issue1397474] timeit execution enviroment

Eli Bendersky report at bugs.python.org
Mon Sep 13 19:23:51 CEST 2010


Eli Bendersky <eliben at gmail.com> added the comment:

Terry,

I'm attaching a patch for 2.7, however it's more proof-of-concept than final, because I have a few comments. The patch generally implements your documentation suggestion without the `import *` warning and without adding the final example. The latter for a couple of reasons:

1) My tests show that passing the callable instead of the string 'test()' actually takes longer to run.

2) When the callable is passed, the setup of importing 'test' from '__main__' is necessary, because the timed code doesn't have to lookup the 'test' symbol. If you want to leave that example in, the setup string can be ditched.

Let me know your thoughts and I will update the patch.

----------
Added file: http://bugs.python.org/file18871/issue1397474.py27.1.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1397474>
_______________________________________


More information about the Python-bugs-list mailing list