[Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions
victor.stinner at gmail.com
Sat Apr 28 03:23:28 CEST 2012
> 1) time.clock is deprecated, but also supported by get_clock_info. Why
> bother supporting it if you don't want people to use it?
It will not be removed before Python 4, the function is still used by
Python < 3.3.
> 2) get_clock_info returns a dict. Why not a namedtuple?
I don't like the tuple API. I prefer a dict over a (named)tuple
because there is an optional key, and we migh add other optional keys
> 3) The dict returned by get_clock_info includes an optional key,
> "is_adjusted". Why is it optional?
The value is not know for some platforms for some clock. I don't know
if process/thread time can be set for example. Sometimes the value is
hardcoded, sometimes the flag comes from the OS (ex: on Windows).
> 4) The section on mach_absolute_time states:
> According to the documentation (Technical Q&A QA1398),
> is always equal to one and never fails, even if the function may fail
> according to its prototype.
> I've read the linked technical note and I can't see anything about it always
> being equal to one. I don't think your description is accurate.
I don't remember where it does come from. I removed the sentence.
> 9) The perf_counter pseudocode seems a bit unusual (unPythonic?) to me.
> Rather than checking flags at call-time, could you not use different
> function definitions at compile time?
It's just a pseudo-code. I prefer to avoid duplication of code. The
pseudo-code is based on the C implemenation which use #ifdef;
More information about the Python-Dev