[Python-ideas] time.wallclock() or other similar stuff
tjreedy at udel.edu
Tue Nov 2 05:47:48 CET 2010
On 11/1/2010 11:38 PM, Steven D'Aprano wrote:
> (1) How many people would think to look in timeit for this function?
> Both you and Kristján were apparently surprised that it already exists,
> and I'd bet money that you weren't the only ones. timeit seems to be
> more of an application than a library (although I acknowledge the border
> between the two is fuzzy), and people don't think about using it as a
> (2) The time module is the natural place to look for time-related
> functions. It would be nicer if timeit could import the default timer
> from time:
> from time import timer as default_timer # or wall_clock if you prefer
> (3) The default_timer is an implementation detail of timeit. It could
> change, or disappear, or be renamed. You'll note it isn't documented:
> (4) I started off thinking that we should just document timer
> (wall_clock) as an alias to one of time() or clock(), but I changed my
> mind. That's an implementation detail that we should be free to change
> in the future. For the sake of information hiding, we shouldn't promise
> that the timer will be one of time.clock() or time.time(). Who knows,
> maybe there are (or will be someday) supported platforms where neither
> choice is appropriate, and the timer needs to be something else?
+1 for timer in time module from me too.
Having two time functions in time of opposite ratings on different
platforms has always (13 years or whenever there became two) seemed like
a wart to me.
Terry Jan Reedy
More information about the Python-ideas