28. Python Runtime Services
The modules described in this chapter provide a wide range of services related to the Python interpreter and its interaction with its environment. Here’s an overview:
- 28.1. sys — System-specific parameters and functions
- 28.2. sysconfig — Provide access to Python’s configuration information
- 28.3. builtins — Built-in objects
- 28.4. __main__ — Top-level script environment
- 28.5. warnings — Warning control
- 28.6. contextlib — Utilities for with-statement contexts
- 28.6.1. Utilities
- 28.6.2. Examples and Recipes
- 28.6.2.1. Supporting a variable number of context managers
- 28.6.2.2. Simplifying support for single optional context managers
- 28.6.2.3. Catching exceptions from __enter__ methods
- 28.6.2.4. Cleaning up in an __enter__ implementation
- 28.6.2.5. Replacing any use of try-finally and flag variables
- 28.6.2.6. Using a context manager as a function decorator
- 28.7. abc — Abstract Base Classes
- 28.8. atexit — Exit handlers
- 28.9. traceback — Print or retrieve a stack traceback
- 28.10. __future__ — Future statement definitions
- 28.11. gc — Garbage Collector interface
- 28.12. inspect — Inspect live objects
- 28.13. site — Site-specific configuration hook
- 28.14. fpectl — Floating point exception control
- 28.15. distutils — Building and installing Python modules