Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d1ced9e

Browse files
Issue #16642: Document kwargs field in sched.Event named tuple.
2 parents 49f7e58 + e912496 commit d1ced9e

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

Doc/library/sched.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ scheduler:
2727

2828
.. versionchanged:: 3.3
2929
*timefunc* and *delayfunc* parameters are optional.
30+
3031
.. versionchanged:: 3.3
3132
:class:`scheduler` class can be safely used in multi-threaded
3233
environments.
@@ -129,4 +130,4 @@ Scheduler Objects
129130

130131
Read-only attribute returning a list of upcoming events in the order they
131132
will be run. Each event is shown as a :term:`named tuple` with the
132-
following fields: time, priority, action, argument.
133+
following fields: time, priority, action, argument, kwargs.

Lib/sched.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
function is allowed to modify the queue. Time can be expressed as
1414
integers or floating point numbers, as long as it is consistent.
1515
16-
Events are specified by tuples (time, priority, action, argument).
16+
Events are specified by tuples (time, priority, action, argument, kwargs).
1717
As in UNIX, lower priority numbers mean higher priority; in this
1818
way the queue can be maintained as a priority queue. Execution of the
1919
event means calling the action function, passing it the argument
2020
sequence in "argument" (remember that in Python, multiple function
21-
arguments are be packed in a sequence).
21+
arguments are be packed in a sequence) and keyword parameters in "kwargs".
2222
The action function may be an instance method so it
2323
has another way to reference private data (besides global variables).
2424
"""
@@ -151,7 +151,7 @@ def queue(self):
151151
"""An ordered list of upcoming events.
152152
153153
Events are named tuples with fields for:
154-
time, priority, action, arguments
154+
time, priority, action, arguments, kwargs
155155
156156
"""
157157
# Use heapq to sort the queue rather than using 'sorted(self._queue)'.

0 commit comments

Comments
 (0)