Karthikeyan Singaravelan <tir.karthi@gmail.com> added the comment: enter takes a relative time and priority is taken into consideration only when time is equal. So in the example enter(0.001, 2) is executed first and there is some delay in executing enter(0.001, 2). You can also view the queue with s.queue which is a heap. So even though they look similar the first call is scheduled earlier than the second one even with lower priority. Your report is correct if the example used enterabs where the time is absolute and then the two events are ordered based on priority with keyword executed first in the heapq used . In your script you can print s.sched and maybe add the same to the report? # enter and s.sched prints different time with positional scheduled to be executed first in time. ➜ cpython git:(master) cat /tmp/bar.py import sched, time s = sched.scheduler(time.time, time.sleep) def print_time(a='default'): print("From print_time", time.time(), a) def print_some_times(): print(time.time()) s.enter(0.001, 2, print_time, argument=('positional',)) s.enter(0.001, 1, print_time, kwargs={'a': 'keyword'}) print(s.queue) s.run() print(time.time()) print_some_times() ➜ cpython git:(master) ./python.exe /tmp/bar.py 1554204002.401897 [Event(time=1554204002.40309, priority=2, action=<function print_time at 0x10e9747e0>, argument=('positional',), kwargs={}), Event(time=1554204002.403158, priority=1, action=<function print_time at 0x10e9747e0>, argument=(), kwargs={'a': 'keyword'})]
From print_time 1554204002.40331 positional From print_time 1554204002.403441 keyword 1554204002.403517
# enterabs and s.sched prints same time with keyword ordered first based on priority with time being equal. ➜ cpython git:(master) cat /tmp/baz.py import sched, time s = sched.scheduler(time.time, time.sleep) def print_time(a='default'): print("From print_time", time.time(), a) def print_some_times(): print(time.time()) s.enterabs(0.001, 2, print_time, argument=('positional',)) s.enterabs(0.001, 1, print_time, kwargs={'a': 'keyword'}) print(s.queue) s.run() print(time.time()) print_some_times() ➜ cpython git:(master) ./python.exe /tmp/baz.py 1554204136.854676 [Event(time=0.001, priority=1, action=<function print_time at 0x1042767e0>, argument=(), kwargs={'a': 'keyword'}), Event(time=0.001, priority=2, action=<function print_time at 0x1042767e0>, argument=('positional',), kwargs={})]
From print_time 1554204136.855422 keyword From print_time 1554204136.855669 positional 1554204136.855788
---------- nosy: +giampaolo.rodola, xtreak _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue34677> _______________________________________