diff options
author | Fred Drake <fdrake@acm.org> | 2003-04-08 17:46:53 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2003-04-08 17:46:53 (GMT) |
commit | 2c2068c4d1d8f0f06065e333f94958ca16145a0e (patch) | |
tree | 1ae31ac2bd448d6512d8f904e36d97fa24583d1b | |
parent | de7ad2caacc00d1abd9064071a5e05109eb82a64 (diff) | |
download | cpython-2c2068c4d1d8f0f06065e333f94958ca16145a0e.zip cpython-2c2068c4d1d8f0f06065e333f94958ca16145a0e.tar.gz cpython-2c2068c4d1d8f0f06065e333f94958ca16145a0e.tar.bz2 |
Added example of using positional and keyword args with atexit.register().
Based on a suggestion from a reader.
-rw-r--r-- | Doc/lib/libatexit.tex | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Doc/lib/libatexit.tex b/Doc/lib/libatexit.tex index 6a72cb3..c9775d1 100644 --- a/Doc/lib/libatexit.tex +++ b/Doc/lib/libatexit.tex @@ -72,3 +72,18 @@ def savecounter(): import atexit atexit.register(savecounter) \end{verbatim} + +Positional and keyword arguments may also be passed to +\function{register()} to be passed along to the registered function +when it is called: + +\begin{verbatim} +def goodbye(name, adjective): + print 'Goodbye, %s, it was %s to meet you.' % (name, adjective) + +import atexit +atexit.register(goodbye, 'Donny', 'nice') + +# or: +atexit.register(goodbye, adjective='nice', name='Donny') +\end{verbatim} |