Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(158586)

Side by Side Diff: Doc/library/threading.rst

Issue 17435: threading.Timer.__init__() should use immutable argument defaults for args and kwargs
Patch Set: Created 6 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Lib/test/test_threading.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`threading` --- Thread-based parallelism 1 :mod:`threading` --- Thread-based parallelism
2 ============================================= 2 =============================================
3 3
4 .. module:: threading 4 .. module:: threading
5 :synopsis: Thread-based parallelism. 5 :synopsis: Thread-based parallelism.
6 6
7 **Source code:** :source:`Lib/threading.py` 7 **Source code:** :source:`Lib/threading.py`
8 8
9 -------------- 9 --------------
10 10
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 832
833 For example:: 833 For example::
834 834
835 def hello(): 835 def hello():
836 print("hello, world") 836 print("hello, world")
837 837
838 t = Timer(30.0, hello) 838 t = Timer(30.0, hello)
839 t.start() # after 30 seconds, "hello, world" will be printed 839 t.start() # after 30 seconds, "hello, world" will be printed
840 840
841 841
842 .. class:: Timer(interval, function, args=[], kwargs={}) 842 .. class:: Timer(interval, function, args=None, kwargs=None)
843 843
844 Create a timer that will run *function* with arguments *args* and keyword 844 Create a timer that will run *function* with arguments *args* and keyword
845 arguments *kwargs*, after *interval* seconds have passed. 845 arguments *kwargs*, after *interval* seconds have passed.
846 If *args* is None (the default) then an empty list will be used.
847 If *kwargs* is None (the default) then an empty dict will be used.
846 848
847 .. versionchanged:: 3.3 849 .. versionchanged:: 3.3
848 changed from a factory function to a class. 850 changed from a factory function to a class.
849 851
850 .. method:: cancel() 852 .. method:: cancel()
851 853
852 Stop the timer, and cancel the execution of the timer's action. This will 854 Stop the timer, and cancel the execution of the timer's action. This will
853 only work if the timer is still in its waiting stage. 855 only work if the timer is still in its waiting stage.
854 856
855 857
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 975
974 some_lock.acquire() 976 some_lock.acquire()
975 try: 977 try:
976 # do something... 978 # do something...
977 finally: 979 finally:
978 some_lock.release() 980 some_lock.release()
979 981
980 Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`, 982 Currently, :class:`Lock`, :class:`RLock`, :class:`Condition`,
981 :class:`Semaphore`, and :class:`BoundedSemaphore` objects may be used as 983 :class:`Semaphore`, and :class:`BoundedSemaphore` objects may be used as
982 :keyword:`with` statement context managers. 984 :keyword:`with` statement context managers.
OLDNEW
« no previous file with comments | « no previous file | Lib/test/test_threading.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+