summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2003-04-08 17:46:53 (GMT)
committerFred Drake <fdrake@acm.org>2003-04-08 17:46:53 (GMT)
commit2c2068c4d1d8f0f06065e333f94958ca16145a0e (patch)
tree1ae31ac2bd448d6512d8f904e36d97fa24583d1b
parentde7ad2caacc00d1abd9064071a5e05109eb82a64 (diff)
downloadcpython-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.tex15
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}