mirror of
https://github.com/python/cpython
synced 2024-10-14 11:58:12 +00:00
Issue 5830: Events are now comparable when the time and type are the same.
This commit is contained in:
parent
6ab91487c4
commit
8f40e099c3
|
@ -33,7 +33,13 @@
|
|||
|
||||
__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:
|
||||
def __init__(self, timefunc, delayfunc):
|
||||
|
|
Loading…
Reference in a new issue