[Python-checkins] r71844 - python/branches/py3k/Lib/sched.py
raymond.hettinger
python-checkins at python.org
Fri Apr 24 20:43:43 CEST 2009
Author: raymond.hettinger
Date: Fri Apr 24 20:43:43 2009
New Revision: 71844
Log:
Issue 5830: Events are now comparable when the time and type are the same.
Modified:
python/branches/py3k/Lib/sched.py
Modified: python/branches/py3k/Lib/sched.py
==============================================================================
--- python/branches/py3k/Lib/sched.py (original)
+++ python/branches/py3k/Lib/sched.py Fri Apr 24 20:43:43 2009
@@ -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):
More information about the Python-checkins
mailing list