This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients giampaolo.rodola, pitrou, rhettinger, serhiy.storchaka
Date 2013-10-21.05:12:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1382332334.81.0.942208700817.issue19270@psf.upfronthosting.co.za>
In-reply-to
Content
> 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".
History
Date User Action Args
2013-10-21 05:12:14rhettingersetrecipients: + rhettinger, pitrou, giampaolo.rodola, serhiy.storchaka
2013-10-21 05:12:14rhettingersetmessageid: <1382332334.81.0.942208700817.issue19270@psf.upfronthosting.co.za>
2013-10-21 05:12:14rhettingerlinkissue19270 messages
2013-10-21 05:12:14rhettingercreate