- Python运行时服务
Python运行时服务
本章里描述的模块提供了和Python解释器及其环境交互相关的广泛服务。以下是综述:
sys—- 系统相关的参数和函数sysconfig—- Provide access to Python's configuration information- 配置变量
- 安装路径
- 其他功能
- Using
sysconfigas a script
builtins—- 内建对象main—- 顶层脚本环境warnings—- Warning control- 警告类别
- The Warnings Filter
- Describing Warning Filters
- 默认警告过滤器
- Overriding the default filter
- 暂时禁止警告
- 测试警告
- Updating Code For New Versions of Dependencies
- Available Functions
- Available Context Managers
dataclasses—- 数据类- 模块级装饰器、类和函数
- 初始化后处理
- 类变量
- 仅初始化变量
- 冻结的实例
- 继承
- 默认工厂函数
- 可变的默认值
- 异常
contextlib—- Utilities forwith-statement contexts- 工具
- 例子和配方
- Supporting a variable number of context managers
- Catching exceptions from
entermethods - Cleaning up in an
enterimplementation - Replacing any use of
try-finallyand flag variables - Using a context manager as a function decorator
- Single use, reusable and reentrant context managers
- Reentrant context managers
- Reusable context managers
abc—- 抽象基类atexit—- 退出处理器atexit示例
traceback—- 打印或检索堆栈回溯TracebackExceptionObjectsStackSummaryObjectsFrameSummaryObjects- Traceback Examples
future—- Future 语句定义gc—- 垃圾回收器接口inspect—- 检查对象- 类型和成员
- Retrieving source code
- Introspecting callables with the Signature object
- 类与函数
- The interpreter stack
- Fetching attributes statically
- Current State of Generators and Coroutines
- Code Objects Bit Flags
- Command Line Interface
site—- Site-specific configuration hook- Readline configuration
- 模块内容
