Runtime Articles

__future__ — Future statement definitions

Source code: Lib/__future__.py

__main__ — Top-level script environment

'__main__' is the name of the scope in which top-level code executes. A module’s __name__ is set equal to '__main__' when read from standard input, a script, or from an interactive prompt.

abc — Abstract Base Classes

Source code: Lib/abc.py

atexit — Exit handlers

The atexit module defines functions to register and unregister cleanup functions. Functions thus registered are automatically executed upon normal interpreter termination. 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.

builtins — Built-in objects

This module provides direct access to all ‘built-in’ identifiers of Python; for example, builtins.open is the full name for the built-in function open(). See Built-in Functions and Built-in Constants for documentation.

contextlib — Utilities for with-statement contexts

Source code: Lib/contextlib.py

dataclasses — Data Classes

Source code: Lib/dataclasses.py

gc — Garbage Collector interface

This module provides an interface to the optional garbage collector. It provides the ability to disable the collector, tune the collection frequency, and set debugging options. It also provides access to unreachable objects that the collector found but cannot free. Since the collector supplements the reference counting already used in Python, you can disable the collector if you are sure your program does not create reference cycles. Automatic collection can be disabled by calling gc.disable(). To debug a leaking program call gc.set_debug(gc.DEBUG_LEAK). Notice that this includes gc.DEBUG_SAVEALL, causing garbage-collected objects to be saved in gc.garbage for inspection.

inspect — Inspect live objects

Source code: Lib/inspect.py

site — Site-specific configuration hook

Source code: Lib/site.py

sys — System-specific parameters and functions

This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available.

sysconfig — Provide access to Python’s configuration information

Source code: Lib/sysconfig.py

traceback — Print or retrieve a stack traceback

Source code: Lib/traceback.py

warnings — Warning control

Source code: Lib/warnings.py