@@ -36,19 +36,22 @@ Example::
3636
3737 >>> import sched, time
3838 >>> s = sched.scheduler(time.time, time.sleep)
39- >>> def print_time(): print("From print_time", time.time())
39+ >>> def print_time(a='default'):
40+ ... print("From print_time", time.time(), a)
4041 ...
4142 >>> def print_some_times():
4243 ... print(time.time())
43- ... s.enter(5, 1, print_time, ())
44- ... s.enter(10, 1, print_time, ())
44+ ... s.enter(10, 1, print_time)
45+ ... s.enter(5, 2, print_time, argument=('positional',))
46+ ... s.enter(5, 1, print_time, kwargs={'a': 'keyword'})
4547 ... s.run()
4648 ... print(time.time())
4749 ...
4850 >>> print_some_times()
4951 930343690.257
50- From print_time 930343695.274
51- From print_time 930343700.273
52+ From print_time 930343695.274 positional
53+ From print_time 930343695.275 keyword
54+ From print_time 930343700.273 default
5255 930343700.276
5356
5457.. _scheduler-objects :
@@ -59,16 +62,18 @@ Scheduler Objects
5962:class: `scheduler ` instances have the following methods and attributes:
6063
6164
62- .. method :: scheduler.enterabs(time, priority, action, argument=[] , kwargs={})
65+ .. method :: scheduler.enterabs(time, priority, action, argument=() , kwargs={})
6366
6467 Schedule a new event. The *time * argument should be a numeric type compatible
6568 with the return value of the *timefunc * function passed to the constructor.
6669 Events scheduled for the same *time * will be executed in the order of their
6770 *priority *.
6871
6972 Executing the event means executing ``action(*argument, **kwargs) ``.
70- *argument * must be a sequence holding the parameters for *action *.
71- *kwargs * must be a dictionary holding the keyword parameters for *action *.
73+ Optional *argument * argument must be a sequence holding the parameters
74+ for *action * if any used.
75+ Optional *kwargs * argument must be a dictionary holding the keyword
76+ parameters for *action * if any used.
7277
7378 Return value is an event which may be used for later cancellation of the event
7479 (see :meth: `cancel `).
@@ -80,7 +85,7 @@ Scheduler Objects
8085 *kwargs * parameter was added.
8186
8287
83- .. method :: scheduler.enter(delay, priority, action, argument=[] , kwargs={})
88+ .. method :: scheduler.enter(delay, priority, action, argument=() , kwargs={})
8489
8590 Schedule an event for *delay * more time units. Other than the relative time, the
8691 other arguments, the effect and the return value are the same as those for
0 commit comments