From: Fred Drake Date: Tue, 8 Apr 2003 17:46:53 +0000 (+0000) Subject: Added example of using positional and keyword args with atexit.register(). X-Git-Tag: v2.3c1~1266 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2c2068c4d1d8f0f06065e333f94958ca16145a0e;p=python Added example of using positional and keyword args with atexit.register(). Based on a suggestion from a reader. --- diff --git a/Doc/lib/libatexit.tex b/Doc/lib/libatexit.tex index 6a72cb3a2c..c9775d1b6d 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}