[Python-checkins] python/dist/src/Doc/lib libatexit.tex,1.7,1.7.24.1

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
2003年4月08日 10:46:35 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv1914
Modified Files:
 Tag: release22-maint
	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.7.24.1
diff -C2 -d -r1.7 -r1.7.24.1
*** libatexit.tex	9 Sep 2000 03:25:11 -0000	1.7
--- libatexit.tex	8 Apr 2003 17:46:33 -0000	1.7.24.1
***************
*** 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}

AltStyle によって変換されたページ (->オリジナル) /