[New-bugs-announce] [issue5441] Convenience API for timeit.main
report at bugs.python.org
Sun Mar 8 07:02:27 CET 2009
New submission from Nick Coghlan <ncoghlan at gmail.com>:
For quick and dirty benchmarking, timeit.main() is one of the handiest
tools out there, but calling it from Python code is a little tedious
since you need to construct a fake list of command line arguments in
order to call it.
What would be nice is a convenience function that accepted appropriate
arguments, with timeit.main being refactored to parse the command line
arguments and then call the new convenience function.
def measure(stmt="pass", setup="pass", timer=default_timer,
The new function would cover the latter section of the current main()
function, starting from the line "t = Timer(stmt, setup, timer)".
components: Library (Lib)
stage: needs patch
title: Convenience API for timeit.main
type: feature request
versions: Python 2.7, Python 3.1
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce