Python 运行时服务 ¶
此章描述的模块提供 Python 解释器及其环境交互相关的广泛服务。这里是概述:
-
sys— 特定系统参数和函数-
abiflags -
addaudithook() -
argv -
audit() -
base_exec_prefix -
base_prefix -
byteorder -
builtin_module_names -
call_tracing() -
copyright -
_clear_type_cache() -
_clear_internal_caches() -
_current_frames() -
_current_exceptions() -
breakpointhook() -
_debugmallocstats() -
dllhandle -
displayhook() -
dont_write_bytecode -
_emscripten_info -
pycache_prefix -
excepthook() -
__breakpointhook__ -
__displayhook__ -
__excepthook__ -
__unraisablehook__ -
exception() -
exc_info() -
exec_prefix -
executable -
exit() -
flags -
float_info -
float_repr_style -
getallocatedblocks() -
getunicodeinternedsize() -
getandroidapilevel() -
getdefaultencoding() -
getdlopenflags() -
getfilesystemencoding() -
getfilesystemencodeerrors() -
get_int_max_str_digits() -
getrefcount() -
getrecursionlimit() -
getsizeof() -
getswitchinterval() -
_getframe() -
_getframemodulename() -
getobjects() -
getprofile() -
gettrace() -
getwindowsversion() -
get_asyncgen_hooks() -
get_coroutine_origin_tracking_depth() -
hash_info -
hexversion -
implementation -
int_info -
__interactivehook__ -
intern() -
_is_gil_enabled() -
is_finalizing() -
last_exc -
_is_interned() -
last_type -
last_value -
last_traceback -
maxsize -
maxunicode -
meta_path -
modules -
orig_argv -
path -
path_hooks -
path_importer_cache -
platform -
platlibdir -
prefix -
ps1 -
ps2 -
setdlopenflags() -
set_int_max_str_digits() -
setprofile() -
setrecursionlimit() -
setswitchinterval() -
settrace() -
set_asyncgen_hooks() -
set_coroutine_origin_tracking_depth() -
activate_stack_trampoline() -
deactivate_stack_trampoline() -
is_stack_trampoline_active() -
_enablelegacywindowsfsencoding() -
stdin -
stdout -
stderr -
__stdin__ -
__stdout__ -
__stderr__ -
stdlib_module_names -
thread_info -
tracebacklimit -
unraisablehook() -
version -
api_version -
version_info -
warnoptions -
winver -
_xoptions
-
-
sys.monitoring— 执行事件监视 -
sysconfig— 提供对 Python 配置信息的访问 -
builtins— 内置对象 -
__main__— 顶层代码环境 -
warnings— 警告控制 -
dataclasses— 数据类 -
contextlib— 实用程序为with语句上下文 -
abc— 抽象基类 -
atexit— 退出处理程序 -
traceback— 打印或检索堆栈回溯 -
__future__— 未来的语句定义 -
gc— 垃圾收集器接口-
enable() -
disable() -
isenabled() -
collect() -
set_debug() -
get_debug() -
get_objects() -
get_stats() -
set_threshold() -
get_count() -
get_threshold() -
get_referrers() -
get_referents() -
is_tracked() -
is_finalized() -
freeze() -
unfreeze() -
get_freeze_count() -
garbage -
callbacks -
DEBUG_STATS -
DEBUG_COLLECTABLE -
DEBUG_UNCOLLECTABLE -
DEBUG_SAVEALL -
DEBUG_LEAK
-
-
inspect— 审查存活对象-
类型和成员
-
getmembers() -
getmembers_static() -
getmodulename() -
ismodule() -
isclass() -
ismethod() -
isfunction() -
isgeneratorfunction() -
isgenerator() -
iscoroutinefunction() -
markcoroutinefunction() -
iscoroutine() -
isawaitable() -
isasyncgenfunction() -
isasyncgen() -
istraceback() -
isframe() -
iscode() -
isbuiltin() -
ismethodwrapper() -
isroutine() -
isabstract() -
ismethoddescriptor() -
isdatadescriptor() -
isgetsetdescriptor() -
ismemberdescriptor()
-
- 检索源代码
- 采用签名对象自省可调用
- 类和函数
- 解释器堆栈
- 静态抓取属性
- Current State of Generators, Coroutines, and Asynchronous Generators
- 代码对象位标志
- Buffer flags
- 命令行接口
-
类型和成员
-
site— 特定站点配置挂钩