classification
Title: sched module example has wrong output
Type: Stage: resolved
Components: Documentation Versions: Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Arvind Padmanabhan, docs@python, xiang.zhang
Priority: normal Keywords:

Created on 2016-09-28 09:31 by Arvind Padmanabhan, last changed 2016-09-28 10:51 by xiang.zhang. This issue is now closed.

Messages (3)
msg277600 - (view) Author: Arvind Padmanabhan (Arvind Padmanabhan) Date: 2016-09-28 09:31
Example in the sched module shows the following output:

930343690.257
From print_time 930343695.274 positional
From print_time 930343695.275 keyword
From print_time 930343700.273 default
930343700.276

But since "keyword" is scheduled with a higher priority (lower number), it should be printed first.

URL: https://docs.python.org/3/library/sched.html
Section: 17.6
msg277602 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-09-28 09:53
Though the delay arguments of keyword and positional are both 5, but their register time has tiny difference: 930343695.274 vs 930343695.275, so positional is printed first.
msg277603 - (view) Author: Xiang Zhang (xiang.zhang) * (Python committer) Date: 2016-09-28 10:00
Sorry, it's not 930343695.274 vs 930343695.275. I mean the register time is time.time() + delay, so there is tiny difference between the two. You can change the timefunc to lambda: int(time.time()), then you'll see keyword is printed first.
History
Date User Action Args
2016-09-28 10:51:13xiang.zhangsetstatus: open -> closed
resolution: not a bug
stage: resolved
2016-09-28 10:00:44xiang.zhangsetmessages: + msg277603
2016-09-28 09:53:35xiang.zhangsetnosy: + xiang.zhang
messages: + msg277602
2016-09-28 09:31:39Arvind Padmanabhancreate