summaryrefslogtreecommitdiff
path: root/Lib/sched.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/sched.py')
-rw-r--r--Lib/sched.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/sched.py b/Lib/sched.py
index b47648d973..3d8c011a5c 100644
--- a/Lib/sched.py
+++ b/Lib/sched.py
@@ -23,11 +23,6 @@ The action function may be an instance method so it
has another way to reference private data (besides global variables).
"""
-# XXX The timefunc and delayfunc should have been defined as methods
-# XXX so you can define new kinds of schedulers using subclassing
-# XXX instead of having to define a module or class just to hold
-# XXX the global state of your particular time and delay functions.
-
import time
import heapq
from collections import namedtuple
@@ -40,12 +35,24 @@ from time import monotonic as _time
__all__ = ["scheduler"]
class Event(namedtuple('Event', 'time, priority, action, argument, kwargs')):
+ __slots__ = []
def __eq__(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)
+Event.time.__doc__ = ('''Numeric type compatible with the return value of the
+timefunc function passed to the constructor.''')
+Event.priority.__doc__ = ('''Events scheduled for the same time will be executed
+in the order of their priority.''')
+Event.action.__doc__ = ('''Executing the event means executing
+action(*argument, **kwargs)''')
+Event.argument.__doc__ = ('''argument is a sequence holding the positional
+arguments for the action.''')
+Event.kwargs.__doc__ = ('''kwargs is a dictionary holding the keyword
+arguments for the action.''')
+
_sentinel = object()
class scheduler: