Kaydet (Commit) 2c2068c4 authored tarafından Fred Drake's avatar Fred Drake

Added example of using positional and keyword args with atexit.register().

Based on a suggestion from a reader.
üst de7ad2ca
......@@ -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}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment