Commit 8f40e099 authored by Raymond Hettinger's avatar Raymond Hettinger

Issue 5830: Events are now comparable when the time and type are the same.

parent 6ab91487
...@@ -33,7 +33,13 @@ from collections import namedtuple ...@@ -33,7 +33,13 @@ from collections import namedtuple
__all__ = ["scheduler"] __all__ = ["scheduler"]
Event = namedtuple('Event', 'time, priority, action, argument') class Event(namedtuple('Event', 'time, priority, action, argument')):
def __eq__(s, o): return (s.time, s.priority) == (o.time, o.priority)
def __ne__(s, o): return (s.time, s.priority) != (o.time, o.priority)
def __lt__(s, o): return (s.time, s.priority) < (o.time, o.priority)
def __le__(s, o): return (s.time, s.priority) <= (o.time, o.priority)
def __gt__(s, o): return (s.time, s.priority) > (o.time, o.priority)
def __ge__(s, o): return (s.time, s.priority) >= (o.time, o.priority)
class scheduler: class scheduler:
def __init__(self, timefunc, delayfunc): def __init__(self, timefunc, delayfunc):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment