[Python-Dev] cpython: Issue #10278: Add an optional strict argument to time.steady(), False by default (original) (raw)

Eric V. Smith eric at trueblade.com
Sat Mar 17 23:07:33 CET 2012


On 3/17/2012 4:47 PM, Michael Foord wrote:

On 17 Mar 2012, at 08:49, Georg Brandl wrote:

On 03/15/2012 01:17 AM, victor.stinner wrote:

+ If available, a monotonic clock is used. By default, if strict is False, + the function falls back to another clock if the monotonic clock failed or is + not available. If strict is True, raise an :exc:OSError on error or + :exc:NotImplementedError if no monotonic clock is available.

This is not clear to me. Why wouldn't it raise OSError on error even with strict=False? Please clarify which exception is raised in which case. It seems clear to me. It doesn't raise exceptions when strict=False because it falls back to a non-monotonic clock. If strict is True and a non- monotonic clock is not available it raises OSError or NotImplementedError.

I have to agree with Georg. Looking at the code, it appears OSError can be raised with both strict=True and strict=False (since floattime() can raise OSError). The text needs to make it clear OSError can always be raised.

I also think "By default, if strict is False" confuses things. If there's a default behavior with strict=False, what's the non-default behavior? I suggest dropping "By default".

Eric.



More information about the Python-Dev mailing list