diff options
author | Damien George <damien.p.george@gmail.com> | 2019-08-15 17:42:38 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-08-15 17:42:38 +1000 |
commit | ed9c0185d80514670244b0c2147958dea00159a9 (patch) | |
tree | 7d6e87b918267681eb1e06ec395c3d6a8e5ab4e6 | |
parent | 28cb15d1313c77a04d1b119089dd1b4c7ac5ebb1 (diff) |
docs/library/sys: Add documentation for sys.atexit function.
-rw-r--r-- | docs/library/sys.rst | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/library/sys.rst b/docs/library/sys.rst index f2d96cb8c..aee2e54ee 100644 --- a/docs/library/sys.rst +++ b/docs/library/sys.rst @@ -15,6 +15,19 @@ Functions function raise as `SystemExit` exception. If an argument is given, its value given as an argument to `SystemExit`. +.. function:: atexit(func) + + Register *func* to be called upon termination. *func* must be a callable + that takes no arguments, or ``None`` to disable the call. The ``atexit`` + function will return the previous value set by this function, which is + initially ``None``. + + .. admonition:: Difference to CPython + :class: attention + + This function is a MicroPython extension intended to provide similar + functionality to the :mod:`atexit` module in CPython. + .. function:: print_exception(exc, file=sys.stdout) Print exception with a traceback to a file-like object *file* (or |