You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
assignee=Noneclosed_at=<Date2021-03-06.01:53:35.241>created_at=<Date2021-03-04.22:21:10.347>labels= ['3.8', '3.9', '3.10', 'docs']
title='time.monotonic(): Docs imply comparing call N and call N+M is invalid for M>1'updated_at=<Date2021-03-06.01:53:35.240>user='https://github.com/moreati'
[21:51] Given a=time.monotonic(); b=time.monotonic(); c=time.monotonic() is c-a < delta a valid comparison? Until this evening I thought so, but I've just read https://docs.python.org/3/library/time.html#time.monotonic and the wording it uses is "only the difference between the results of consecutive calls is valid" implying b-a < delta is valid, or c-b < delta; but not c-a < delta. Am I understanding the wording correctly?
[21:52] IOW is it literally only call n, and n+1. or n, and n+m?
[21:53] moreati, I think "consecutive" is incorrect there, based on the rest of that sentence.
[21:57] moreati SnoopJ yes, I agree, the consecutive wording has tripped me up when I first started using monotonic. I think there's an understated transitive property that allows a to c comparisons just fine.
[21:58] jarthur, yea, it would be deeply weird if b-a and c-b were meaningful deltas, but c-a was not
[21:59] re time.monotonic() the only reason I could of for the literal interpretation of the wording is an overflow, or integer wraparound corner case
[22:00] weirdly, the CPython doc uses the same language
[22:02] I actually ended up looking at the monotonic code a while back, and at least back then the wraparound case is really hard to reach, maybe possible on Windows if you haven't called it in a while. Either way, there was nothing in the Linux/glibc or Windows calls used that would have made the wraparound/overflow case apply to skipped evaluation of a middle observation more than it would consecutive observations.
[22:06] moreati, looks like this language was added when the function was, and I guess maybe nobody's ever raised this complaint about the wording: https://hg.python.org/cpython/rev/376ce937823c
[22:07] nice catch :)
[22:22] FTR https://bugs.python.org/issue43407
[22:28] moreati, I would recommend just submitting the PR, since it's docs.
[22:28] but I think the best wording would be something like "only the difference between two calls of this function is meaningful"
[22:30] agreed, subsequent is a $5 word in a 50c requirement. May I quote our conversation in the ticket? Ditto jarthur
[22:30] but yea, just open a PR, that way you need a single pass from someone with authority here rather than two ;)
[22:31] >Never use a long word where a short one will do.