This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rurpy
Recipients
Date 2006-01-05.03:50:10
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
library reference manual, section 10.10

The documentation for the timeit module 
does not make clear exactly what enviroment
the timed code will be run in, particularly
when a function in the current program is 
being timed (as opposed to an external 
program.)

This information is available in the examples
section but examples should illustrate already 
described behavior, not present new information.

I think the following text should be appended 
below the third paragraph in the "class Timer"
section which reads:

  To measure the execution time of the first 
  statement, use the timeit() method. The 
  repeat() method is a convenience to call 
  timeit() multiple times and return a list
  of results. 

Proposed addition:

  The timed statement is executed in the namespace
  of the timeit module.  If a function in the 
  __main__ module is being timed, it can
  be made accessible to the timer module by
  using a setup statement like 
    "from __main__ import xx"
  where xx is the function's name in __main__.
  Of course "__main__" can be a different module
  name if appropriate.



History
Date User Action Args
2007-08-23 14:37:10adminlinkissue1397474 messages
2007-08-23 14:37:10admincreate