Matthew Fisher added the comment:
> I did look at the code :-)
I also looked at the code. I had to do so to understand why the example output
was not "as expected." ;)
> I don't agree about the example in the documentation, it is a clear
> demonstration about how to use the API in general
Raymond Hettinger added the comment:
It would be nice to either modify the example or add another example to show
the use of enterabs() and of the priority field being used as a tie breaker for
two events scheduled at the same time.
--
nosy: +rhettinger
status: pending -> open
__
Ronald Oussoren added the comment:
I did look at the code :-)
The enter() method just calls enterabs() with an absolute time calculated from
the current time (using the timefunc for the scheduler) and the passed relative
time. Two calls of enter() with the same relative time will therefore u
R. David Murray added the comment:
I think Ronald is correct.
The priority argument for enter would apply if you called enter twice with two
different delays, but they happen to end up pointing to the same moment in time
from the scheduler's point of view.
How would the computer know that tw
sahilmn added the comment:
The task schedule is executed when `s.run()` is called. There should be a
*delay = 5* from the time the scheduling statement is executed.
If your claim is true, the priority argument is useless since it has no
impact on the execution order when `delay` values are equ
Ronald Oussoren added the comment:
I don't think there's a bug here: sched.enter schedules an event some time
after the current time. The two calls to sched.enter are not at the same time,
hence the priority is not used because the events are scheduled at different
times.
--
nosy: +
New submission from sahilmn :
`sched.enter` doesn't work as expected. If two events are scheduled with the
same delay, then their order of execution seems to be dictated by the order of
`enter` statements for the events instead of the priority order.
Ref attached file with example code. `sched