Raymond Hettinger added the comment:

> 1. sched.cancel() can remove wrong event
> (because it uses equality instead identity).

I don't think this is a bug.  The user should be able to define events that can 
be compared on equality.  It is the user's responsibility to make sure that 
events are distinct (this is no different than how list.remove() works for 
example).

> 2. sched.cancel() change order of equal (by time and priority) events.

That is allowed.   We make no stability guarantees.  Plus it just makes sense 
that events with the same time and priority are non-deterministic.

Note, to add stability we would have to store the order that events were added. 
 This would slow down the code.

Add note that Tornado uses heapq in its ioloop in the same way that the 
schedule module does.  It too makes no effort to preserve input order.

I recommend closing this as "not a bug" or as an "further document the existing 
behaviors".

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19270>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to