[Python-Dev] [RFC] PEP 418: Add monotonic time, performance counter and process time functions (original) (raw)

Victor Stinner victor.stinner at gmail.com
Sat Apr 28 03:23:28 CEST 2012


1) time.clock is deprecated, but also supported by getclockinfo. 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) getclockinfo 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 later.

3) The dict returned by getclockinfo includes an optional key, "isadjusted". 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 machabsolutetime states:

According to the documentation (Technical Q&A QA1398), machtimebaseinfo() 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 perfcounter 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;

Victor



More information about the Python-Dev mailing list