[docs] [issue1397474] timeit execution enviroment

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

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


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>

More information about the docs mailing list