From: Fred Drake Date: Tue, 8 Apr 2003 17:46:33 +0000 (+0000) Subject: Added example of using positional and keyword args with atexit.register(). X-Git-Tag: v2.2.3c1~81 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=71e300eeea9b127bb8bd6dd380bbcffd4746630f;p=thirdparty%2FPython%2Fcpython.git 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 6a72cb3a2c30..c9775d1b6ddf 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}