diff options
Diffstat (limited to 'Doc/library/threading.rst')
-rw-r--r-- | Doc/library/threading.rst | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 8c76643..2bcb72b 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -314,7 +314,7 @@ since it is impossible to detect the termination of alien threads. or "Thread-*N* (target)" where "target" is ``target.__name__`` if the *target* argument is specified. - *args* is the argument tuple for the target invocation. Defaults to ``()``. + *args* is a list or tuple of arguments for the target invocation. Defaults to ``()``. *kwargs* is a dictionary of keyword arguments for the target invocation. Defaults to ``{}``. @@ -353,6 +353,19 @@ since it is impossible to detect the termination of alien threads. the *target* argument, if any, with positional and keyword arguments taken from the *args* and *kwargs* arguments, respectively. + Using list or tuple as the *args* argument which passed to the :class:`Thread` + could achieve the same effect. + + Example:: + + >>> from threading import Thread + >>> t = Thread(target=print, args=[1]) + >>> t.run() + 1 + >>> t = Thread(target=print, args=(1,)) + >>> t.run() + 1 + .. method:: join(timeout=None) Wait until the thread terminates. This blocks the calling thread until |