[Python-checkins] python/dist/src/Doc/lib libatexit.tex,1.7,1.8
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Tue, 08 Apr 2003 10:46:55 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv2032
Modified Files:
libatexit.tex
Log Message:
Added example of using positional and keyword args with atexit.register().
Based on a suggestion from a reader.
Index: libatexit.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libatexit.tex,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** libatexit.tex 9 Sep 2000 03:25:11 -0000 1.7
--- libatexit.tex 8 Apr 2003 17:46:53 -0000 1.8
***************
*** 73,74 ****
--- 73,89 ----
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}