Python Runtime 服務
*******************

本章節所描述的模組提供了與 Python 直譯器及其與環境互動相關的廣泛服務。
以下是概觀：

* "sys" --- 系統特定的參數與函式

* "sys.monitoring" --- 執行事件監控

  * 工具識別器

    * 註冊和使用工具

  * 事件

    * 區域事件

    * 附屬事件 (ancillary events)

    * 其他事件

    * STOP_ITERATION 事件

  * 開啟和關閉事件

    * 全域設定事件

    * 各別程式碼物件事件

    * 停用事件

  * 註冊回呼函式

    * 回呼函式引數

* "sysconfig" --- 提供 Python 設定資訊的存取

  * Configuration variables

  * Installation paths

  * User scheme

    * "posix_user"

    * "nt_user"

    * "osx_framework_user"

  * Home scheme

    * "posix_home"

  * Prefix scheme

    * "posix_prefix"

    * "nt"

  * 安裝路徑函式

  * 其他函式

  * 命令列用法

* "builtins" --- 內建物件

* "__main__" --- 頂層程式碼環境

  * "__name__ == '__main__'"

    * 什麼是「頂層程式碼環境」？

    * 慣用 (Idiomatic) 用法

    * 打包時須考慮的事情

  * Python 套件中的 "__main__.py"

    * 慣用 (Idiomatic) 用法

  * "import __main__"

* "warnings" --- 警告控制

  * 警告類別

  * 警告過濾器

    * 重複警告的抑制標準

    * 描述警告過濾器

    * 預設警告過濾器

    * 覆寫預設過濾器

  * 暫時抑制警告

  * 測試警告

  * 為新版相依套件更新程式碼

  * 可用的函式

  * 可用的情境管理器

* "dataclasses" --- Data Classes

  * 模組內容

  * Post-init processing

  * 類別變數

  * Init-only variables

  * 凍結實例

  * 繼承

  * Re-ordering of keyword-only parameters in "__init__()"

  * 預設工廠函式

  * 可變預設值

  * Descriptor-typed fields

* "contextlib" --- "with" 陳述式工具程式

  * Utilities

  * Examples and Recipes

    * Supporting a variable number of context managers

    * Catching exceptions from "__enter__" methods

    * Cleaning up in an "__enter__" implementation

    * Replacing any use of "try-finally" and 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" --- 列印或取得堆疊回溯 (stack traceback)

  * Module-Level Functions

  * "TracebackException" 物件

  * "StackSummary" 物件

  * "FrameSummary" 物件

  * Examples of Using the Module-Level Functions

  * "TracebackException" 的使用範例

* "__future__" --- Future 陳述式定義

  * 模組內容

* "gc" --- 垃圾回收器介面 (Garbage Collector interface)

* "inspect" --- 檢視活動物件

  * Types and members

  * 取得原始碼

  * Introspecting callables with the Signature object

  * 類別與函式

  * 直譯器堆疊

  * Fetching attributes statically

  * Current State of Generators, Coroutines, and Asynchronous
    Generators

  * Code Objects Bit Flags

  * Buffer flags

  * Command-line interface

* "site" --- Site-specific configuration hook

  * "sitecustomize"

  * "usercustomize"

  * Readline configuration

  * 模組內容

  * Command-line interface
