Serhiy Storchaka added the comment:

> I'm not strong on a new invariant, however I think bug #1 would deserve 
> fixing:

How would you do this?

1. Use identity instead equality to search canceled event. It will break code 
where an user cancels an event by time and priority: 
scheduler.cancel(Event(time, priority, ...)).

2. Always cancel chronologically last (first) of equals events. This requires 
popp-ing and push-ing all events. Too slooooow.

3. Add an ordered number to the event. This will slow down all too.

4. Mixed strategy. First use identity search, then equality search, and only if 
found several equals events fallback to slow variant. This is too complicated. 
It will work as expected in most normal cases, but in rare cases... This 
behavior would hard to document and understand.

If you have better idea, patch is welcome.

----------

_______________________________________
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