diff -r a1c8302e6b27 Doc/library/atexit.rst --- a/Doc/library/atexit.rst Sun Jul 01 12:24:20 2012 +0200 +++ b/Doc/library/atexit.rst Mon Jul 02 16:23:38 2012 +0200 @@ -9,13 +9,15 @@ The :mod:`atexit` module defines functions to register and unregister cleanup functions. Functions thus registered are automatically executed upon normal -interpreter termination. The order in which the functions are called is not -defined; if you have cleanup operations that depend on each other, you should -wrap them in a function and register that one. This keeps :mod:`atexit` simple. +interpreter termination. :mod:`atexit` runs these functions in the *reverse* +order in which they were registered; if you register ``A``, ``B``, and ``C``, +at interpreter termination time they will be run in the order ``C``, ``B``, +``A``. -Note: the functions registered via this module are not called when the program -is killed by a signal not handled by Python, when a Python fatal internal error -is detected, or when :func:`os._exit` is called. +.. note:: + The functions registered via this module are not called when the program + is killed by a signal not handled by Python, when a Python fatal internal + error is detected, or when :func:`os._exit` is called. .. function:: register(func, *args, **kargs)