### 導航
- [索引](genindex.xhtml "總目錄")
- [模塊](py-modindex.xhtml "Python 模塊索引") |
- [下一頁](about.xhtml "文檔說明") |
- [上一頁](faq/installed.xhtml "“為什么我的電腦上安裝了 Python ?”") |
- 
- [Python](https://www.python.org/) ?
- zh\_CN 3.7.3 [文檔](index.xhtml) ?
- $('.inline-search').show(0); |
# 術語對照表
`>>>`交互式終端中默認的 Python 提示符。往往會顯示于能以交互方式在解釋器里執行的樣例代碼之前。
`...`交互式終端中輸入特殊代碼行時默認的 Python 提示符,包括:縮進的代碼塊,成對的分隔符之內(圓括號、方括號、花括號或三重引號),或是指定一個裝飾器之后。
2to3一個將 Python 2.x 代碼轉換為 Python 3.x 代碼的工具,能夠處理大部分通過解析源碼并遍歷解析樹可檢測到的不兼容問題。
2to3 包含在標準庫中,模塊名為 [`lib2to3`](library/2to3.xhtml#module-lib2to3 "lib2to3: the 2to3 library");并提供一個獨立入口點 `Tools/scripts/2to3`。參見 [2to3 - 自動將 Python 2 代碼轉為 Python 3 代碼](library/2to3.xhtml#to3-reference)。
abstract base class -- 抽象基類抽象基類簡稱 ABC,是對 [duck-typing](#term-duck-typing) 的補充,它提供了一種定義接口的新方式,相比之下其他技巧例如 [`hasattr()`](library/functions.xhtml#hasattr "hasattr") 顯得過于笨拙或有微妙錯誤(例如使用 [魔術方法](reference/datamodel.xhtml#special-lookup))。ABC 引入了虛擬子類,這種類并非繼承自其他類,但卻仍能被 [`isinstance()`](library/functions.xhtml#isinstance "isinstance") 和 [`issubclass()`](library/functions.xhtml#issubclass "issubclass") 所認可;詳見 [`abc`](library/abc.xhtml#module-abc "abc: Abstract base classes according to PEP 3119.") 模塊文檔。Python 自帶許多內置的 ABC 用于實現數據結構(在 [`collections.abc`](library/collections.abc.xhtml#module-collections.abc "collections.abc: Abstract base classes for containers") 模塊中)、數字(在 [`numbers`](library/numbers.xhtml#module-numbers "numbers: Numeric abstract base classes (Complex, Real, Integral, etc.).") 模塊中)、流(在 [`io`](library/io.xhtml#module-io "io: Core tools for working with streams.") 模塊中)、導入查找器和加載器(在 [`importlib.abc`](library/importlib.xhtml#module-importlib.abc "importlib.abc: Abstract base classes related to import") 模塊中)。你可以使用 [`abc`](library/abc.xhtml#module-abc "abc: Abstract base classes according to PEP 3119.") 模塊來創建自己的 ABC。
annotation -- 標注關聯到某個變量、類屬性、函數形參或返回值的標簽,被約定作為 [type hint](#term-type-hint) 來使用。
局部變量的標注在運行時不可訪問,但全局變量、類屬性和函數的標注會分別存放模塊、類和函數的 `__annotations__` 特殊屬性中。
參見 [variable annotation](#term-variable-annotation)、[function annotation](#term-function-annotation)、[**PEP 484**](https://www.python.org/dev/peps/pep-0484) \[https://www.python.org/dev/peps/pep-0484\] 和 [**PEP 526**](https://www.python.org/dev/peps/pep-0526) \[https://www.python.org/dev/peps/pep-0526\],對此功能均有介紹。
argument -- 參數在調用函數時傳給 [function](#term-function) (或 [method](#term-method) )的值。參數分為兩種:
- *關鍵字參數*: 在函數調用中前面帶有標識符(例如 `name=`)或者作為包含在前面帶有 `**` 的字典里的值傳入。舉例來說,`3` 和 `5` 在以下對 [`complex()`](library/functions.xhtml#complex "complex") 的調用中均屬于關鍵字參數:
```
complex(real=3, imag=5)
complex(**{'real': 3, 'imag': 5})
```
- *位置參數*: 不屬于關鍵字參數的參數。位置參數可出現于參數列表的開頭以及/或者作為前面帶有 `*` 的 [iterable](#term-iterable) 里的元素被傳入。舉例來說,`3` 和 `5` 在以下調用中均屬于位置參數:
```
complex(3, 5)
complex(*(3, 5))
```
參數會被賦值給函數體中對應的局部變量。有關賦值規則參見 [調用](reference/expressions.xhtml#calls) 一節。根據語法,任何表達式都可用來表示一個參數;最終算出的值會被賦給對應的局部變量。
另參見 [parameter](#term-parameter) 術語表條目,常見問題中 [參數與形參的區別](faq/programming.xhtml#faq-argument-vs-parameter) 以及 [**PEP 362**](https://www.python.org/dev/peps/pep-0362) \[https://www.python.org/dev/peps/pep-0362\]。
asynchronous context manager -- 異步上下文管理器此種對象通過定義 [`__aenter__()`](reference/datamodel.xhtml#object.__aenter__ "object.__aenter__") 和 [`__aexit__()`](reference/datamodel.xhtml#object.__aexit__ "object.__aexit__") 方法來對 [`async with`](reference/compound_stmts.xhtml#async-with) 語句中的環境進行控制。由 [**PEP 492**](https://www.python.org/dev/peps/pep-0492) \[https://www.python.org/dev/peps/pep-0492\] 引入。
asynchronous generator -- 異步生成器返回值為 [asynchronous generator iterator](#term-asynchronous-generator-iterator) 的函數。它與使用 [`async def`](reference/compound_stmts.xhtml#async-def) 定義的協程函數很相似,不同之處在于它包含 [`yield`](reference/simple_stmts.xhtml#yield) 表達式以產生一系列可在 [`async for`](reference/compound_stmts.xhtml#async-for) 循環中使用的值。
此術語通常是指異步生成器函數,但在某些情況下則可能是指 *異步生成器迭代器*。如果需要清楚表達具體含義,請使用全稱以避免歧義。
一個異步生成器函數可能包含 [`await`](reference/expressions.xhtml#await) 表達式或者 [`async for`](reference/compound_stmts.xhtml#async-for) 以及 [`async with`](reference/compound_stmts.xhtml#async-with) 語句。
asynchronous generator iterator -- 異步生成器迭代器[asynchronous generator](#term-asynchronous-generator) 函數所創建的對象。
此對象屬于 [asynchronous iterator](#term-asynchronous-iterator),當使用 [`__anext__()`](reference/datamodel.xhtml#object.__anext__ "object.__anext__") 方法調用時會返回一個可等待對象來執行異步生成器函數的代碼直到下一個 [`yield`](reference/simple_stmts.xhtml#yield) 表達式。
每個 [`yield`](reference/simple_stmts.xhtml#yield) 會臨時暫停處理,記住當前位置執行狀態 (包括局部變量和掛起的 try 語句)。當該 *異步生成器迭代器* 與其他 [`__anext__()`](reference/datamodel.xhtml#object.__anext__ "object.__anext__") 返回的可等待對象有效恢復時,它會從離開位置繼續執行。參見 [**PEP 492**](https://www.python.org/dev/peps/pep-0492) \[https://www.python.org/dev/peps/pep-0492\] 和 [**PEP 525**](https://www.python.org/dev/peps/pep-0525) \[https://www.python.org/dev/peps/pep-0525\]。
asynchronous iterable -- 異步可迭代對象可在 [`async for`](reference/compound_stmts.xhtml#async-for) 語句中被使用的對象。必須通過它的 [`__aiter__()`](reference/datamodel.xhtml#object.__aiter__ "object.__aiter__") 方法返回一個 [asynchronous iterator](#term-asynchronous-iterator)。由 [**PEP 492**](https://www.python.org/dev/peps/pep-0492) \[https://www.python.org/dev/peps/pep-0492\] 引入。
asynchronous iterator -- 異步迭代器實現了 [`__aiter__()`](reference/datamodel.xhtml#object.__aiter__ "object.__aiter__") 和 [`__anext__()`](reference/datamodel.xhtml#object.__anext__ "object.__anext__") 方法的對象。`__anext__` 必須返回一個 [awaitable](#term-awaitable) 對象。[`async for`](reference/compound_stmts.xhtml#async-for) 會處理異步迭代器的 [`__anext__()`](reference/datamodel.xhtml#object.__anext__ "object.__anext__") 方法所返回的可等待對象,直到其引發一個 [`StopAsyncIteration`](library/exceptions.xhtml#StopAsyncIteration "StopAsyncIteration") 異常。由 [**PEP 492**](https://www.python.org/dev/peps/pep-0492) \[https://www.python.org/dev/peps/pep-0492\] 引入。
attribute -- 屬性關聯到一個對象的值,可以使用點號表達式通過其名稱來引用。例如,如果一個對象 *o* 具有一個屬性 *a*,就可以用 *o.a* 來引用它。
awaitable -- 可等待對象能在 [`await`](reference/expressions.xhtml#await) 表達式中使用的對象。可以是 [coroutine](#term-coroutine) 或是具有 [`__await__()`](reference/datamodel.xhtml#object.__await__ "object.__await__") 方法的對象。參見 [**PEP 492**](https://www.python.org/dev/peps/pep-0492) \[https://www.python.org/dev/peps/pep-0492\]。
BDFL“終身仁慈獨裁者”的英文縮寫,即 [Guido van Rossum](https://gvanrossum.github.io/) \[https://gvanrossum.github.io/\],Python 的創造者。
binary file -- 二進制文件[file object](#term-file-object) 能夠讀寫 [字節類對象](#term-bytes-like-object)。二進制文件的例子包括以二進制模式(`'rb'`, `'wb'` or `'rb+'`)打開的文件、`sys.stdin.buffer`、`sys.stdout.buffer` 以及 [`io.BytesIO`](library/io.xhtml#io.BytesIO "io.BytesIO") 和 [`gzip.GzipFile`](library/gzip.xhtml#gzip.GzipFile "gzip.GzipFile") 的實例。
另請參見 [text file](#term-text-file) 了解能夠讀寫 [`str`](library/stdtypes.xhtml#str "str") 對象的文件對象。
bytes-like object -- 字節類對象支持 [緩沖協議](c-api/buffer.xhtml#bufferobjects) 并且能導出 C-[contiguous](#term-contiguous) 緩沖的對象。這包括所有 [`bytes`](library/stdtypes.xhtml#bytes "bytes")、[`bytearray`](library/stdtypes.xhtml#bytearray "bytearray") 和 [`array.array`](library/array.xhtml#array.array "array.array") 對象,以及許多普通 [`memoryview`](library/stdtypes.xhtml#memoryview "memoryview") 對象。字節類對象可在多種二進制數據操作中使用;這些操作包括壓縮、保存為二進制文件以及通過套接字發送等。
某些操作需要可變的二進制數據。這種對象在文檔中常被稱為“可讀寫字節類對象”。可變緩沖對象的例子包括 [`bytearray`](library/stdtypes.xhtml#bytearray "bytearray") 以及 [`bytearray`](library/stdtypes.xhtml#bytearray "bytearray") 的 [`memoryview`](library/stdtypes.xhtml#memoryview "memoryview")。其他操作要求二進制數據存放于不可變對象 ("只讀字節類對象");這種對象的例子包括 [`bytes`](library/stdtypes.xhtml#bytes "bytes") 以及 [`bytes`](library/stdtypes.xhtml#bytes "bytes") 對象的 [`memoryview`](library/stdtypes.xhtml#memoryview "memoryview")。
bytecode -- 字節碼Python 源代碼會被編譯為字節碼,即 CPython 解釋器中表示 Python 程序的內部代碼。字節碼還會緩存在 `.pyc` 文件中,這樣第二次執行同一文件時速度更快(可以免去將源碼重新編譯為字節碼)。這種 "中間語言" 運行在根據字節碼執行相應機器碼的 [virtual machine](#term-virtual-machine) 之上。請注意不同 Python 虛擬機上的字節碼不一定通用,也不一定能在不同 Python 版本上兼容。
字節碼指令列表可以在 [dis 模塊](library/dis.xhtml#bytecodes) 的文檔中查看。
class -- 類用來創建用戶定義對象的模板。類定義通常包含對該類的實例進行操作的方法定義。
class variable -- 類變量在類中定義的變量,并且僅限在類的層級上修改 (而不是在類的實例中修改)。
coercion -- 強制類型轉換在包含兩個相同類型參數的操作中,一種類型的實例隱式地轉換為另一種類型。例如,`int(3.15)` 是將原浮點數轉換為整型數 `3`,但在 `3+4.5` 中,參數的類型不一致(一個是 int, 一個是 float),兩者必須轉換為相同類型才能相加,否則將引發 [`TypeError`](library/exceptions.xhtml#TypeError "TypeError")。如果沒有強制類型轉換機制,程序員必須將所有可兼容參數歸一化為相同類型,例如要寫成 `float(3)+4.5` 而不是 `3+4.5`。
complex number -- 復數對普通實數系統的擴展,其中所有數字都被表示為一個實部和一個虛部的和。虛數是虛數單位(`-1` 的平方根)的實倍數,通常在數學中寫為 `i`,在工程學中寫為 `j`。Python 內置了對復數的支持,采用工程學標記方式;虛部帶有一個 `j` 后綴,例如 `3+1j`。如果需要 [`math`](library/math.xhtml#module-math "math: Mathematical functions (sin() etc.).") 模塊內對象的對應復數版本,請使用 [`cmath`](library/cmath.xhtml#module-cmath "cmath: Mathematical functions for complex numbers."),復數的使用是一個比較高級的數學特性。如果你感覺沒有必要,忽略它們也幾乎不會有任何問題。
context manager -- 上下文管理器在 [`with`](reference/compound_stmts.xhtml#with) 語句中使用,通過定義 [`__enter__()`](reference/datamodel.xhtml#object.__enter__ "object.__enter__") 和 [`__exit__()`](reference/datamodel.xhtml#object.__exit__ "object.__exit__") 方法來控制環境狀態的對象。參見 [**PEP 343**](https://www.python.org/dev/peps/pep-0343) \[https://www.python.org/dev/peps/pep-0343\]。
ntext variable A variable which can have different values depending on its context. This is similar to Thread-Local Storage in which each execution thread may have a different value for a variable. However, with context variables, there may be several contexts in one execution thread and the main usage for context variables is to keep track of variables in concurrent asynchronous tasks. See [`contextvars`](library/contextvars.xhtml#module-contextvars "contextvars: Context Variables").
contiguous -- 連續一個緩沖如果是 *C 連續* 或 *Fortran 連續* 就會被認為是連續的。零維緩沖是 C 和 Fortran 連續的。在一維數組中,所有條目必須在內存中彼此相鄰地排列,采用從零開始的遞增索引順序。在多維 C-連續數組中,當按內存地址排列時用最后一個索引訪問條目時速度最快。但是在 Fortran 連續數組中則是用第一個索引最快。
coroutine -- 協程協程是子例程的更一般形式。子例程可以在某一點進入并在另一點退出。協程則可以在許多不同的點上進入、退出和恢復。它們可通過 [`async def`](reference/compound_stmts.xhtml#async-def) 語句來實現。參見 [**PEP 492**](https://www.python.org/dev/peps/pep-0492) \[https://www.python.org/dev/peps/pep-0492\]。
coroutine function -- 協程函數返回一個 [coroutine](#term-coroutine) 對象的函數。協程函數可通過 [`async def`](reference/compound_stmts.xhtml#async-def) 語句來定義,并可能包含 [`await`](reference/expressions.xhtml#await)、[`async for`](reference/compound_stmts.xhtml#async-for) 和 [`async with`](reference/compound_stmts.xhtml#async-with) 關鍵字。這些特性是由 [**PEP 492**](https://www.python.org/dev/peps/pep-0492) \[https://www.python.org/dev/peps/pep-0492\] 引入的。
CPythonPython 編程語言的規范實現,在 [python.org](https://www.python.org) \[https://www.python.org\] 上發布。"CPython" 一詞用于在必要時將此實現與其他實現例如 Jython 或 IronPython 相區別。
decorator -- 裝飾器返回值為另一個函數的函數,通常使用 `@wrapper` 語法形式來進行函數變換。 裝飾器的常見例子包括 [`classmethod()`](library/functions.xhtml#classmethod "classmethod") 和 [`staticmethod()`](library/functions.xhtml#staticmethod "staticmethod")。
裝飾器語法只是一種語法糖,以下兩個函數定義在語義上完全等價:
```
def f(...):
...
f = staticmethod(f)
@staticmethod
def f(...):
...
```
同的樣概念也適用于類,但通常較少這樣使用。有關裝飾器的詳情可參見 [函數定義](reference/compound_stmts.xhtml#function) 和 [類定義](reference/compound_stmts.xhtml#class) 的文檔。
descriptor -- 描述器任何定義了 [`__get__()`](reference/datamodel.xhtml#object.__get__ "object.__get__"), [`__set__()`](reference/datamodel.xhtml#object.__set__ "object.__set__") 或 [`__delete__()`](reference/datamodel.xhtml#object.__delete__ "object.__delete__") 方法的對象。當一個類屬性為描述器時,它的特殊綁定行為就會在屬性查找時被觸發。通常情況下,使用 *a.b* 來獲取、設置或刪除一個屬性時會在 *a* 的類字典中查找名稱為 *b* 的對象,但如果 *b* 是一個描述器,則會調用對應的描述器方法。理解描述器的概念是更深層次理解 Python 的關鍵,因為這是許多重要特性的基礎,包括函數、方法、屬性、類方法、靜態方法以及對超類的引用等等。
有關描述符的方法的詳情可參看 [實現描述器](reference/datamodel.xhtml#descriptors)。
dictionary -- 字典一個關聯數組,其中的任意鍵都映射到相應的值。鍵可以是任何具有 [`__hash__()`](reference/datamodel.xhtml#object.__hash__ "object.__hash__") 和 [`__eq__()`](reference/datamodel.xhtml#object.__eq__ "object.__eq__") 方法的對象。在 Perl 語言中稱為 hash。
dictionary view -- 字典視圖從 [`dict.keys()`](library/stdtypes.xhtml#dict.keys "dict.keys"), [`dict.values()`](library/stdtypes.xhtml#dict.values "dict.values") 和 [`dict.items()`](library/stdtypes.xhtml#dict.items "dict.items") 返回的對象被稱為字典視圖。它們提供了字典條目的一個動態視圖,這意味著當字典改變時,視圖也會相應改變。要將字典視圖強制轉換為真正的列表,可使用 `list(dictview)`。參見 [字典視圖對象](library/stdtypes.xhtml#dict-views)。
docstring -- 文檔字符串作為類、函數或模塊之內的第一個表達式出現的字符串字面值。它在代碼執行時會被忽略,但會被解釋器識別并放入所在類、函數或模塊的 `__doc__` 屬性中。由于它可用于代碼內省,因此是對象存放文檔的規范位置。
duck-typing -- 鴨子類型指一種編程風格,它并不依靠查找對象類型來確定其是否具有正確的接口,而是直接調用或使用其方法或屬性(“看起來像鴨子,叫起來也像鴨子,那么肯定就是鴨子。”)由于強調接口而非特定類型,設計良好的代碼可通過允許多態替代來提升靈活性。鴨子類型避免使用 [`type()`](library/functions.xhtml#type "type") 或 [`isinstance()`](library/functions.xhtml#isinstance "isinstance") 檢測。(但要注意鴨子類型可以使用 [抽象基類](#term-abstract-base-class) 作為補充。) 而往往會采用 [`hasattr()`](library/functions.xhtml#hasattr "hasattr") 檢測或是 [EAFP](#term-eafp) 編程。
EAFP“求原諒比求許可更容易”的英文縮寫。這種 Python 常用代碼編寫風格會假定所需的鍵或屬性存在,并在假定錯誤時捕獲異常。這種簡潔快速風格的特點就是大量運用 [`try`](reference/compound_stmts.xhtml#try) 和 [`except`](reference/compound_stmts.xhtml#except) 語句。于其相對的則是所謂 [LBYL](#term-lbyl) 風格,常見于 C 等許多其他語言。
expression -- 表達式可以求出某個值的語法單元。 換句話說,一個表達式就是表達元素例如字面值、名稱、屬性訪問、運算符或函數調用的匯總,它們最終都會返回一個值。 與許多其他語言不同,并非所有語言構件都是表達式。 還存在不能被用作表達式的 [statement](#term-statement),例如 [`while`](reference/compound_stmts.xhtml#while)。 賦值也是屬于語句而非表達式。
extension module -- 擴展模塊以 C 或 C++ 編寫的模塊,使用 Python 的 C API 來與語言核心以及用戶代碼進行交互。
f-string -- f-字符串帶有 `'f'` 或 `'F'` 前綴的字符串字面值通常被稱為“f-字符串”即 [格式化字符串字面值](reference/lexical_analysis.xhtml#f-strings) 的簡寫。參見 [**PEP 498**](https://www.python.org/dev/peps/pep-0498) \[https://www.python.org/dev/peps/pep-0498\]。
file object -- 文件對象對外提供面向文件 API 以使用下層資源的對象(帶有 `read()` 或 `write()` 這樣的方法)。根據其創建方式的不同,文件對象可以處理對真實磁盤文件,對其他類型存儲,或是對通訊設備的訪問(例如標準輸入/輸出、內存緩沖區、套接字、管道等等)。文件對象也被稱為 *文件類對象* 或 *流*。
實際上共有三種類別的文件對象: 原始 [二進制文件](#term-binary-file), 緩沖 [二進制文件](#term-binary-file) 以及 [文本文件](#term-text-file)。它們的接口定義均在 [`io`](library/io.xhtml#module-io "io: Core tools for working with streams.") 模塊中。創建文件對象的規范方式是使用 [`open()`](library/functions.xhtml#open "open") 函數。
file-like object -- 文件類對象[file object](#term-file-object) 的同義詞。
finder -- 查找器一種會嘗試查找被導入模塊的 [loader](#term-loader) 的對象。
從 Python 3.3 起存在兩種類型的查找器: [元路徑查找器](#term-meta-path-finder) 配合 [`sys.meta_path`](library/sys.xhtml#sys.meta_path "sys.meta_path") 使用,以及 [path entry finders](#term-path-entry-finder) 配合 [`sys.path_hooks`](library/sys.xhtml#sys.path_hooks "sys.path_hooks") 使用。
更多詳情可參見 [**PEP 302**](https://www.python.org/dev/peps/pep-0302) \[https://www.python.org/dev/peps/pep-0302\], [**PEP 420**](https://www.python.org/dev/peps/pep-0420) \[https://www.python.org/dev/peps/pep-0420\] 和 [**PEP 451**](https://www.python.org/dev/peps/pep-0451) \[https://www.python.org/dev/peps/pep-0451\]。
floor division -- 向下取整除法向下舍入到最接近的整數的數學除法。向下取整除法的運算符是 `//` 。例如,表達式 `11 // 4` 的計算結果是 `2` ,而與之相反的是浮點數的真正除法返回 `2.75` 。注意 `(-11) // 4` 會返回 `-3` 因為這是 `-2.75` *向下* 舍入得到的結果。見 [**PEP 238**](https://www.python.org/dev/peps/pep-0238) \[https://www.python.org/dev/peps/pep-0238\] 。
function -- 函數可以向調用者返回某個值的一組語句。還可以向其傳入零個或多個 [參數](#term-argument) 并在函數體執行中被使用。另見 [parameter](#term-parameter), [method](#term-method) 和 [函數定義](reference/compound_stmts.xhtml#function) 等節。
function annotation -- 函數標注即針對函數形參或返回值的 [annotation](#term-annotation) 。
函數標注通常用于 [類型提示](#term-type-hint):例如以下函數預期接受兩個 [`int`](library/functions.xhtml#int "int") 參數并預期返回一個 [`int`](library/functions.xhtml#int "int") 值:
```
def sum_two_numbers(a: int, b: int) -> int:
return a + b
```
函數標注語法的詳解見 [函數定義](reference/compound_stmts.xhtml#function) 一節。
請參看 [variable annotation](#term-variable-annotation) 和 [**PEP 484**](https://www.python.org/dev/peps/pep-0484) \[https://www.python.org/dev/peps/pep-0484\] 對此功能的描述。
\_\_future\_\_一種偽模塊,可被程序員用來啟用與當前解釋器不兼容的新語言特性。
通過導入 [`__future__`](library/__future__.xhtml#module-__future__ "__future__: Future statement definitions") 模塊并對其中的變量求值,你可以查看新特性何時首次加入語言以及何時成為默認:
```
>>> import __future__
>>> __future__.division
_Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192)
```
garbage collection -- 垃圾回收釋放不再被使用的內存空間的過程。Python 是通過引用計數和一個能夠檢測和打破循環引用的循環垃圾回收器來執行垃圾回收的。可以使用 [`gc`](library/gc.xhtml#module-gc "gc: Interface to the cycle-detecting garbage collector.") 模塊來控制垃圾回收器。
generator -- 生成器返回一個 [generator iterator](#term-generator-iterator) 的函數。它看起來很像普通函數,不同點在于其包含 [`yield`](reference/simple_stmts.xhtml#yield) 表達式以便產生一系列值供給 for-循環使用或是通過 [`next()`](library/functions.xhtml#next "next") 函數逐一獲取。
通常是指生成器函數,但在某些情況下也可能是指 *生成器迭代器*。如果需要清楚表達具體含義,請使用全稱以避免歧義。
generator iterator -- 生成器迭代器[generator](#term-generator) 函數所創建的對象。
每個 [`yield`](reference/simple_stmts.xhtml#yield) 會臨時暫停處理,記住當前位置執行狀態(包括局部變量和掛起的 try 語句)。當該 *生成器迭代器* 恢復時,它會從離開位置繼續執行(這與每次調用都從新開始的普通函數差別很大)。
generator expression -- 生成器表達式返回一個迭代器的表達式。 它看起來很像普通表達式后面帶有定義了一個循環變量、范圍的 `for` 子句,以及一個可選的 `if` 子句。 以下復合表達式會為外層函數生成一系列值:
```
>>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81
285
```
generic function -- 泛型函數為不同的類型實現相同操作的多個函數所組成的函數。在調用時會由調度算法來確定應該使用哪個實現。
另請參見 [single dispatch](#term-single-dispatch) 術語表條目、[`functools.singledispatch()`](library/functools.xhtml#functools.singledispatch "functools.singledispatch") 裝飾器以及 [**PEP 443**](https://www.python.org/dev/peps/pep-0443) \[https://www.python.org/dev/peps/pep-0443\]。
GIL參見 [global interpreter lock](#term-global-interpreter-lock)。
global interpreter lock -- 全局解釋器鎖[CPython](#term-cpython) 解釋器所采用的一種機制,它確保同一時刻只有一個線程在執行 Python [bytecode](#term-bytecode)。此機制通過設置對象模型(包括 [`dict`](library/stdtypes.xhtml#dict "dict") 等重要內置類型)針對并發訪問的隱式安全簡化了 CPython 實現。給整個解釋器加鎖使得解釋器多線程運行更方便,其代價則是犧牲了在多處理器上的并行性。
不過,某些標準庫或第三方庫的擴展模塊被設計為在執行計算密集型任務如壓縮或哈希時釋放 GIL。此外,在執行 I/O 操作時也總是會釋放 GIL。
創建一個(以更精細粒度來鎖定共享數據的)“自由線程”解釋器的努力從未獲得成功,因為這會犧牲在普通單處理器情況下的性能。據信克服這種性能問題的措施將導致實現變得更復雜,從而更難以維護。
hash-based pyc -- 基于哈希的 pyc使用對應源文件的哈希值而非最后修改時間來確定其有效性的字節碼緩存文件。 參見 [已緩存字節碼的失效](reference/import.xhtml#pyc-invalidation)。
hashable -- 可哈希一個對象的哈希值如果在其生命周期內絕不改變,就被稱為 *可哈希* (它需要具有 [`__hash__()`](reference/datamodel.xhtml#object.__hash__ "object.__hash__") 方法),并可以同其他對象進行比較(它需要具有 [`__eq__()`](reference/datamodel.xhtml#object.__eq__ "object.__eq__") 方法)。可哈希對象必須具有相同的哈希值比較結果才會相同。
可哈希性使得對象能夠作為字典鍵或集合成員使用,因為這些數據結構要在內部使用哈希值。
所有 Python 中的不可變內置對象都是可哈希的;可變容器(例如列表或字典)都不可哈希。用戶定義類的實例對象默認是可哈希的。它們在比較時一定不相同(除非是與自己比較),它們的哈希值的生成基于其 [`id()`](library/functions.xhtml#id "id")。
IDLEPython 的 IDE,“集成開發與學習環境”的英文縮寫。是 Python 標準發行版附帶的基本編程器和解釋器環境。
immutable -- 不可變具有固定值的對象。不可變對象包括數字、字符串和元組。這樣的對象不能被改變。如果必須存儲一個不同的值,則必須創建新的對象。它們在需要常量哈希值的地方起著重要作用,例如作為字典中的鍵。
import path -- 導入路徑由多個位置(或 [路徑條目](#term-path-entry))組成的列表,會被模塊的 [path based finder](#term-path-based-finder) 用來查找導入目標。在導入時,此位置列表通常來自 [`sys.path`](library/sys.xhtml#sys.path "sys.path"),但對次級包來說也可能來自上級包的 `__path__` 屬性。
importing -- 導入令一個模塊中的 Python 代碼能為另一個模塊中的 Python 代碼所使用的過程。
importer -- 導入器查找并加載模塊的對象;此對象既屬于 [finder](#term-finder) 又屬于 [loader](#term-loader)。
interactive -- 交互Python 帶有一個交互式解釋器,即你可以在解釋器提示符后輸入語句和表達式,立即執行并查看其結果。只需不帶參數地啟動 `python` 命令(也可以在你的計算機開始菜單中選擇相應菜單項)。在測試新想法或檢驗模塊和包的時候用這種方式會非常方便(請記得使用 `help(x)`)。
interpreted -- 解釋型Python 一是種解釋型語言,與之相對的是編譯型語言,雖然兩者的區別由于字節碼編譯器的存在而會有所模糊。這意味著源文件可以直接運行而不必顯式地創建可執行文件再運行。解釋型語言通常具有比編譯型語言更短的開發/調試周期,但是其程序往往運行得更慢。參見 [interactive](#term-interactive)。
interpreter shutdown -- 解釋器關閉當被要求關閉時,Python 解釋器將進入一個特殊運行階段并逐步釋放所有已分配資源,例如模塊和各種關鍵內部結構等。它還會多次調用 [垃圾回收器](#term-garbage-collection)。這會觸發用戶定義析構器或弱引用回調中的代碼執行。在關閉階段執行的代碼可能會遇到各種異常,因為其所依賴的資源已不再有效(常見的例子有庫模塊或警告機制等)。
解釋器需要關閉的主要原因有 `__main__` 模塊或所運行的腳本已完成執行。
iterable -- 可迭代對象能夠逐一返回其成員項的對象。可迭代對象的例子包括所有序列類型(例如 [`list`](library/stdtypes.xhtml#list "list")、[`str`](library/stdtypes.xhtml#str "str") 和 [`tuple`](library/stdtypes.xhtml#tuple "tuple"))以及某些非序列類型例如 [`dict`](library/stdtypes.xhtml#dict "dict")、[文件對象](#term-file-object) 以及定義了 [`__iter__()`](reference/datamodel.xhtml#object.__iter__ "object.__iter__") 方法或是實現了 [Sequence](#term-sequence) 語義的 [`__getitem__()`](reference/datamodel.xhtml#object.__getitem__ "object.__getitem__") 方法的任意自定義類對象。
可迭代對象被可用于 [`for`](reference/compound_stmts.xhtml#for) 循環以及許多其他需要一個序列的地方([`zip()`](library/functions.xhtml#zip "zip")、[`map()`](library/functions.xhtml#map "map") ...)。當一個可迭代對象作為參數傳給內置函數 [`iter()`](library/functions.xhtml#iter "iter") 時,它會返回該對象的迭代器。這種迭代器適用于對值集合的一次性遍歷。在使用可迭代對象時,你通常不需要調用 [`iter()`](library/functions.xhtml#iter "iter") 或者自己處理迭代器對象。`for` 語句會為你自動處理那些操作,創建一個臨時的未命名變量用來在循環期間保存迭代器。參見 [iterator](#term-iterator)、[sequence](#term-sequence) 以及 [generator](#term-generator)。
iterator -- 迭代器用來表示一連串數據流的對象。重復調用迭代器的 [`__next__()`](library/stdtypes.xhtml#iterator.__next__ "iterator.__next__") 方法(或將其傳給內置函數 [`next()`](library/functions.xhtml#next "next"))將逐個返回流中的項。當沒有數據可用時則將引發 [`StopIteration`](library/exceptions.xhtml#StopIteration "StopIteration") 異常。到這時迭代器對象中的數據項已耗盡,繼續調用其 `__next__()` 方法只會再次引發 [`StopIteration`](library/exceptions.xhtml#StopIteration "StopIteration") 異常。迭代器必須具有 [`__iter__()`](reference/datamodel.xhtml#object.__iter__ "object.__iter__") 方法用來返回該迭代器對象自身,因此迭代器必定也是可迭代對象,可被用于其他可迭代對象適用的大部分場合。一個顯著的例外是那些會多次重復訪問迭代項的代碼。容器對象(例如 [`list`](library/stdtypes.xhtml#list "list"))在你每次向其傳入 [`iter()`](library/functions.xhtml#iter "iter") 函數或是在 [`for`](reference/compound_stmts.xhtml#for) 循環中使用它時都會產生一個新的迭代器。如果在此情況下你嘗試用迭代器則會返回在之前迭代過程中被耗盡的同一迭代器對象,使其看起來就像是一個空容器。
更多信息可查看 [迭代器類型](library/stdtypes.xhtml#typeiter)。
key function -- 鍵函數鍵函數或稱整理函數,是能夠返回用于排序或排位的值的可調用對象。例如,[`locale.strxfrm()`](library/locale.xhtml#locale.strxfrm "locale.strxfrm") 可用于生成一個符合特定區域排序約定的排序鍵。
Python 中有許多工具都允許用鍵函數來控制元素的排位或分組方式。其中包括 [`min()`](library/functions.xhtml#min "min"), [`max()`](library/functions.xhtml#max "max"), [`sorted()`](library/functions.xhtml#sorted "sorted"), [`list.sort()`](library/stdtypes.xhtml#list.sort "list.sort"), [`heapq.merge()`](library/heapq.xhtml#heapq.merge "heapq.merge"), [`heapq.nsmallest()`](library/heapq.xhtml#heapq.nsmallest "heapq.nsmallest"), [`heapq.nlargest()`](library/heapq.xhtml#heapq.nlargest "heapq.nlargest") 以及 [`itertools.groupby()`](library/itertools.xhtml#itertools.groupby "itertools.groupby")。
要創建一個鍵函數有多種方式。例如,[`str.lower()`](library/stdtypes.xhtml#str.lower "str.lower") 方法可以用作忽略大小寫排序的鍵函數。另外,鍵函數也可通過 [`lambda`](reference/expressions.xhtml#lambda) 表達式來創建,例如 `lambda r: (r[0], r[2])`。還有 [`operator`](library/operator.xhtml#module-operator "operator: Functions corresponding to the standard operators.") 模塊提供了三個鍵函數構造器:[`attrgetter()`](library/operator.xhtml#operator.attrgetter "operator.attrgetter")、[`itemgetter()`](library/operator.xhtml#operator.itemgetter "operator.itemgetter") 和 [`methodcaller()`](library/operator.xhtml#operator.methodcaller "operator.methodcaller")。請查看 [如何排序](howto/sorting.xhtml#sortinghowto) 一節以獲取創建和使用鍵函數的示例。
keyword argument -- 關鍵字參數參見 [argument](#term-argument)。
lambda由一個單獨 [expression](#term-expression) 構成的匿名內聯函數,表達式會在調用時被求值。創建 lambda 函數的句法為 `lambda [parameters]: expression`
LBYL“先查看后跳躍”的英文縮寫。這種代碼編寫風格會在進行調用或查找之前顯式地檢查前提條件。此風格與 [EAFP](#term-eafp) 方式恰成對比,其特點是大量使用 [`if`](reference/compound_stmts.xhtml#if) 語句。
在多線程環境中,LBYL 方式會導致“查看”和“跳躍”之間發生條件競爭風險。例如,以下代碼 `if key in mapping: return mapping[key]` 可能由于在檢查操作之后其他線程從 *mapping* 中移除了 *key* 而出錯。這種問題可通過加鎖或使用 EAFP 方式來解決。
list -- 列表Python 內置的一種 [sequence](#term-sequence)。雖然名為列表,但更類似于其他語言中的數組而非鏈接列表,因為訪問元素的時間復雜度為 O(1)。
list comprehension -- 列表推導式處理一個序列中的所有或部分元素并返回結果列表的一種緊湊寫法。`result = ['{:#04x}'.format(x) for x in range(256) if x % 2 == 0]` 將生成一個 0 到 255 范圍內的十六進制偶數對應字符串(0x..)的列表。其中 [`if`](reference/compound_stmts.xhtml#if) 子句是可選的,如果省略則 `range(256)` 中的所有元素都會被處理。
loader -- 加載器負責加載模塊的對象。它必須定義名為 `load_module()` 的方法。加載器通常由一個 [finder](#term-finder) 返回。詳情參見 [**PEP 302**](https://www.python.org/dev/peps/pep-0302) \[https://www.python.org/dev/peps/pep-0302\],對于 [abstract base class](#term-abstract-base-class) 可參見 [`importlib.abc.Loader`](library/importlib.xhtml#importlib.abc.Loader "importlib.abc.Loader")。
magic method -- 魔術方法[special method](#term-special-method) 的非正式同義詞 。
mapping -- 映射一種支持任意鍵查找并實現了 [`Mapping`](library/collections.abc.xhtml#collections.abc.Mapping "collections.abc.Mapping") 或 [`MutableMapping`](library/collections.abc.xhtml#collections.abc.MutableMapping "collections.abc.MutableMapping") [抽象基類](library/collections.abc.xhtml#collections-abstract-base-classes) 中所規定方法的容器對象。 此類對象的例子包括 [`dict`](library/stdtypes.xhtml#dict "dict"), [`collections.defaultdict`](library/collections.xhtml#collections.defaultdict "collections.defaultdict"), [`collections.OrderedDict`](library/collections.xhtml#collections.OrderedDict "collections.OrderedDict") 以及 [`collections.Counter`](library/collections.xhtml#collections.Counter "collections.Counter")。
meta path finder -- 元路徑查找器[`sys.meta_path`](library/sys.xhtml#sys.meta_path "sys.meta_path") 的搜索所返回的 [finder](#term-finder)。元路徑查找器與 [path entry finders](#term-path-entry-finder) 存在關聯但并不相同。
請查看 [`importlib.abc.MetaPathFinder`](library/importlib.xhtml#importlib.abc.MetaPathFinder "importlib.abc.MetaPathFinder") 了解元路徑查找器所實現的方法。
metaclass -- 元類一種用于創建類的類。類定義包含類名、類字典和基類列表。元類負責接受上述三個參數并創建相應的類。大部分面向對象的編程語言都會提供一個默認實現。Python 的特別之處在于可以創建自定義元類。大部分用戶永遠不需要這個工具,但當需要出現時,元類可提供強大而優雅的解決方案。它們已被用于記錄屬性訪問日志、添加線程安全性、跟蹤對象創建、實現單例,以及其他許多任務。
更多詳情參見 [元類](reference/datamodel.xhtml#metaclasses)。
method -- 方法在類內部定義的函數。如果作為該類的實例的一個屬性來調用,方法將會獲取實例對象作為其第一個 [argument](#term-argument) (通常命名為 `self`)。參見 [function](#term-function) 和 [nested scope](#term-nested-scope)。
method resolution order -- 方法解析順序方法解析順序就是在查找成員時搜索全部基類所用的先后順序。請查看 [Python 2.3 方法解析順序](https://www.python.org/download/releases/2.3/mro/) \[https://www.python.org/download/releases/2.3/mro/\] 了解自 2.3 版起 Python 解析器所用相關算法的詳情。
module -- 模塊此對象是 Python 代碼的一種組織單位。各模塊具有獨立的命名空間,可包含任意 Python 對象。模塊可通過 [importing](#term-importing) 操作被加載到 Python 中。
另見 [package](#term-package)。
module spec -- 模塊規格一個命名空間,其中包含用于加載模塊的相關導入信息。是 [`importlib.machinery.ModuleSpec`](library/importlib.xhtml#importlib.machinery.ModuleSpec "importlib.machinery.ModuleSpec") 的實例。
MRO參見 [method resolution order](#term-method-resolution-order)。
mutable -- 可變可變對象可以在其 [`id()`](library/functions.xhtml#id "id") 保持固定的情況下改變其取值。另請參見 [immutable](#term-immutable)。
named tuple -- 具名元組任何類似元組的類,其中的可索引元素也能使用名稱屬性來訪問。(例如,[`time.localtime()`](library/time.xhtml#time.localtime "time.localtime") 會返回一個類似元組的對象,其中的 *year* 既可以通過索引訪問如 `t[0]` 也可以通過名稱屬性訪問如 `t.tm_year`)。
具名元組可以是一個內置類型例如 [`time.struct_time`](library/time.xhtml#time.struct_time "time.struct_time"),也可以通過正規的類定義來創建。一個完備的具名元組還可以通過工廠函數 [`collections.namedtuple()`](library/collections.xhtml#collections.namedtuple "collections.namedtuple") 來創建。后面這種方式會自動提供一些額外特性,例如 `Employee(name='jones', title='programmer')` 這樣的自包含文檔表示形式。
namespace -- 命名空間命名空間是存放變量的場所。命名空間有局部、全局和內置的,還有對象中的嵌套命名空間(在方法之內)。命名空間通過防止命名沖突來支持模塊化。例如,函數 [`builtins.open`](library/functions.xhtml#open "open") 與 [`os.open()`](library/os.xhtml#os.open "os.open") 可通過各自的命名空間來區分。命名空間還通過明確哪個模塊實現那個函數來幫助提高可讀性和可維護性。例如,[`random.seed()`](library/random.xhtml#random.seed "random.seed") 或 [`itertools.islice()`](library/itertools.xhtml#itertools.islice "itertools.islice") 這種寫法明確了這些函數是由 [`random`](library/random.xhtml#module-random "random: Generate pseudo-random numbers with various common distributions.") 與 [`itertools`](library/itertools.xhtml#module-itertools "itertools: Functions creating iterators for efficient looping.") 模塊分別實現的。
namespace package -- 命名空間包[**PEP 420**](https://www.python.org/dev/peps/pep-0420) \[https://www.python.org/dev/peps/pep-0420\] 所引入的一種僅被用作子包的容器的 [package](#term-package),命名空間包可以沒有實體表示物,其描述方式與 [regular package](#term-regular-package) 不同,因為它們沒有 `__init__.py` 文件。
另可參見 [module](#term-module)。
nested scope -- 嵌套作用域在一個定義范圍內引用變量的能力。例如,在另一函數之內定義的函數可以引用前者的變量。請注意嵌套作用域默認只對引用有效而對賦值無效。局部變量的讀寫都受限于最內層作用域。類似的,全局變量的讀寫則作用于全局命名空間。通過 [`nonlocal`](reference/simple_stmts.xhtml#nonlocal) 關鍵字可允許寫入外層作用域。
new-style class -- 新式類對于目前已被應于所有類對象的類形式的舊稱謂。在早先的 Python 版本中,只有新式類能夠使用 Python 新增的更靈活特性,例如 [`__slots__`](reference/datamodel.xhtml#object.__slots__ "object.__slots__")、描述符、特征屬性、[`__getattribute__()`](reference/datamodel.xhtml#object.__getattribute__ "object.__getattribute__")、類方法和靜態方法等。
object -- 對象任何具有狀態(屬性或值)以及預定義行為(方法)的數據。object 也是任何 [new-style class](#term-new-style-class) 的最頂層基類名。
package -- 包一種可包含子模塊或遞歸地包含子包的 Python [module](#term-module)。從技術上說,包是帶有 `__path__` 屬性的 Python 模塊。
另參見 [regular package](#term-regular-package) 和 [namespace package](#term-namespace-package)。
parameter -- 形參[function](#term-function) (或方法)定義中的命名實體,它指定函數可以接受的一個 [argument](#term-argument) (或在某些情況下,多個實參)。有五種形參:
- *positional-or-keyword*:位置或關鍵字,指定一個可以作為 [位置參數](#term-argument) 傳入也可以作為 [關鍵字參數](#term-argument) 傳入的實參。這是默認的形參類型,例如下面的 *foo* 和 *bar*:
```
def func(foo, bar=None): ...
```
- *positional-only*:僅限位置,指定一個只能按位置傳入的參數。Python 中沒有定義僅限位置形參的語法。但是一些內置函數有僅限位置形參(比如 [`abs()`](library/functions.xhtml#abs "abs"))。
- *keyword-only*:僅限關鍵字,指定一個只能通過關鍵字傳入的參數。僅限關鍵字形參可通過在函數定義的形參列表中包含單個可變位置形參或者在多個可變位置形參之前放一個 `*` 來定義,例如下面的 *kw\_only1* 和 *kw\_only2*:
```
def func(arg, *, kw_only1, kw_only2): ...
```
- *var-positional*:可變位置,指定可以提供由一個任意數量的位置參數構成的序列(附加在其他形參已接受的位置參數之后)。這種形參可通過在形參名稱前加綴 `*` 來定義,例如下面的 *args*:
```
def func(*args, **kwargs): ...
```
- *var-keyword*:可變關鍵字,指定可以提供任意數量的關鍵字參數(附加在其他形參已接受的關鍵字參數之后)。這種形參可通過在形參名稱前加綴 `**` 來定義,例如上面的 *kwargs*。
形參可以同時指定可選和必選參數,也可以為某些可選參數指定默認值。
另參見 [argument](#term-argument) 術語表條目、[參數與形參的區別](faq/programming.xhtml#faq-argument-vs-parameter) 中的常見問題、[`inspect.Parameter`](library/inspect.xhtml#inspect.Parameter "inspect.Parameter") 類、[函數定義](reference/compound_stmts.xhtml#function) 一節以及 [**PEP 362**](https://www.python.org/dev/peps/pep-0362) \[https://www.python.org/dev/peps/pep-0362\]。
path entry -- 路徑入口[import path](#term-import-path) 中的一個單獨位置,會被 [path based finder](#term-path-based-finder) 用來查找要導入的模塊。
path entry finder -- 路徑入口查找器任一可調用對象使用 [`sys.path_hooks`](library/sys.xhtml#sys.path_hooks "sys.path_hooks") (即 [path entry hook](#term-path-entry-hook)) 返回的 [finder](#term-finder),此種對象能通過 [path entry](#term-path-entry) 來定位模塊。
請參看 [`importlib.abc.PathEntryFinder`](library/importlib.xhtml#importlib.abc.PathEntryFinder "importlib.abc.PathEntryFinder") 以了解路徑入口查找器所實現的各個方法。
path entry hook -- 路徑入口鉤子一種可調用對象,在知道如何查找特定 [path entry](#term-path-entry) 中的模塊的情況下能夠使用 `sys.path_hook` 列表返回一個 [path entry finder](#term-path-entry-finder)。
path based finder -- 基于路徑的查找器默認的一種 [元路徑查找器](#term-meta-path-finder),可在一個 [import path](#term-import-path) 中查找模塊。
path-like object -- 路徑類對象代表一個文件系統路徑的對象。類路徑對象可以是一個表示路徑的 [`str`](library/stdtypes.xhtml#str "str") 或者 [`bytes`](library/stdtypes.xhtml#bytes "bytes") 對象,還可以是一個實現了 [`os.PathLike`](library/os.xhtml#os.PathLike "os.PathLike") 協議的對象。一個支持 [`os.PathLike`](library/os.xhtml#os.PathLike "os.PathLike") 協議的對象可通過調用 [`os.fspath()`](library/os.xhtml#os.fspath "os.fspath") 函數轉換為 [`str`](library/stdtypes.xhtml#str "str") 或者 [`bytes`](library/stdtypes.xhtml#bytes "bytes") 類型的文件系統路徑;[`os.fsdecode()`](library/os.xhtml#os.fsdecode "os.fsdecode") 和 [`os.fsencode()`](library/os.xhtml#os.fsencode "os.fsencode") 可被分別用來確保獲得 [`str`](library/stdtypes.xhtml#str "str") 或 [`bytes`](library/stdtypes.xhtml#bytes "bytes") 類型的結果。此對象是由 [**PEP 519**](https://www.python.org/dev/peps/pep-0519) \[https://www.python.org/dev/peps/pep-0519\] 引入的。
PEP“Python 增強提議”的英文縮寫。一個 PEP 就是一份設計文檔,用來向 Python 社區提供信息,或描述一個 Python 的新增特性及其進度或環境。PEP 應當提供精確的技術規格和所提議特性的原理說明。
PEP 應被作為提出主要新特性建議、收集社區對特定問題反饋以及為必須加入 Python 的設計決策編寫文檔的首選機制。PEP 的作者有責任在社區內部建立共識,并應將不同意見也記入文檔。
參見 [**PEP 1**](https://www.python.org/dev/peps/pep-0001) \[https://www.python.org/dev/peps/pep-0001\]。
portion -- 部分構成一個命名空間包的單個目錄內文件集合(也可能存放于一個 zip 文件內),具體定義見 [**PEP 420**](https://www.python.org/dev/peps/pep-0420) \[https://www.python.org/dev/peps/pep-0420\]。
positional argument -- 位置參數參見 [argument](#term-argument)。
provisional API -- 暫定 API暫定 API 是指被有意排除在標準庫的向后兼容性保證之外的應用編程接口。雖然此類接口通常不會再有重大改變,但只要其被標記為暫定,就可能在核心開發者確定有必要的情況下進行向后不兼容的更改(甚至包括移除該接口)。此種更改并不會隨意進行 -- 僅在 API 被加入之前未考慮到的嚴重基礎性缺陷被發現時才可能會這樣做。
即便是對暫定 API 來說,向后不兼容的更改也會被視為“最后的解決方案” —— 任何問題被確認時都會盡可能先嘗試找到一種向后兼容的解決方案。
這種處理過程允許標準庫持續不斷地演進,不至于被有問題的長期性設計缺陷所困。詳情見 [**PEP 411**](https://www.python.org/dev/peps/pep-0411) \[https://www.python.org/dev/peps/pep-0411\]。
provisional package -- 暫定包參見 [provisional API](#term-provisional-api)。
Python 3000Python 3.x 發布路線的昵稱(這個名字在版本 3 的發布還遙遙無期的時候就已出現了)。有時也被縮寫為“Py3k”。
Pythonic指一個思路或一段代碼緊密遵循了 Python 語言最常用的風格和理念,而不是使用其他語言中通用的概念來實現代碼。例如,Python 的常用風格是使用 [`for`](reference/compound_stmts.xhtml#for) 語句循環來遍歷一個可迭代對象中的所有元素。許多其他語言沒有這樣的結構,因此不熟悉 Python 的人有時會選擇使用一個數字計數器:
```
for i in range(len(food)):
print(food[i])
```
而相應的更簡潔更 Pythonic 的方法是這樣的:
```
for piece in food:
print(piece)
```
qualified name -- 限定名稱一個以點號分隔的名稱,顯示從模塊的全局作用域到該模塊中定義的某個類、函數或方法的“路徑”,相關定義見 [**PEP 3155**](https://www.python.org/dev/peps/pep-3155) \[https://www.python.org/dev/peps/pep-3155\]。對于最高層級的函數和類,限定名稱與對象名稱一致:
```
>>> class C:
... class D:
... def meth(self):
... pass
...
>>> C.__qualname__
'C'
>>> C.D.__qualname__
'C.D'
>>> C.D.meth.__qualname__
'C.D.meth'
```
當被用于引用模塊時,*完整限定名稱* 意為標示該模塊的以點號分隔的整個路徑,其中包含其所有的父包,例如 `email.mime.text`:
```
>>> import email.mime.text
>>> email.mime.text.__name__
'email.mime.text'
```
reference count -- 引用計數對特定對象的引用的數量。當一個對象的引用計數降為零時,所分配資源將被釋放。引用計數對 Python 代碼來說通常是不可見的,但它是 [CPython](#term-cpython) 實現的一個關鍵元素。[`sys`](library/sys.xhtml#module-sys "sys: Access system-specific parameters and functions.") 模塊定義了一個 [`getrefcount()`](library/sys.xhtml#sys.getrefcount "sys.getrefcount") 函數,程序員可調用它來返回特定對象的引用計數。
regular package -- 正規包傳統型的 [package](#term-package),例如包含有一個 `__init__.py` 文件的目錄。
另參見 [namespace package](#term-namespace-package)。
\_\_slots\_\_一種寫在類內部的聲明,通過預先聲明實例屬性等對象并移除實例字典來節省內存。雖然這種技巧很流行,但想要用好卻并不容易,最好是只保留在少數情況下采用,例如極耗內存的應用程序,并且其中包含大量實例。
sequence -- 序列一種 [iterable](#term-iterable),它支持通過 [`__getitem__()`](reference/datamodel.xhtml#object.__getitem__ "object.__getitem__") 特殊方法來使用整數索引進行高效的元素訪問,并定義了一個返回序列長度的 [`__len__()`](reference/datamodel.xhtml#object.__len__ "object.__len__") 方法。內置的序列類型有 [`list`](library/stdtypes.xhtml#list "list")、[`str`](library/stdtypes.xhtml#str "str")、[`tuple`](library/stdtypes.xhtml#tuple "tuple") 和 [`bytes`](library/stdtypes.xhtml#bytes "bytes")。注意雖然 [`dict`](library/stdtypes.xhtml#dict "dict") 也支持 [`__getitem__()`](reference/datamodel.xhtml#object.__getitem__ "object.__getitem__") 和 [`__len__()`](reference/datamodel.xhtml#object.__len__ "object.__len__"),但它被認為屬于映射而非序列,因為它查找時使用任意的 [immutable](#term-immutable) 鍵而非整數。
[`collections.abc.Sequence`](library/collections.abc.xhtml#collections.abc.Sequence "collections.abc.Sequence") 抽象基類定義了一個更豐富的接口,它超越了 [`__getitem__()`](reference/datamodel.xhtml#object.__getitem__ "object.__getitem__") 和 [`__len__()`](reference/datamodel.xhtml#object.__len__ "object.__len__"),添加了 `count()`, `index()`, [`__contains__()`](reference/datamodel.xhtml#object.__contains__ "object.__contains__") 和 [`__reversed__()`](reference/datamodel.xhtml#object.__reversed__ "object.__reversed__") 。 可以使用 `register()` 顯式注冊實現此擴展接口的類型。
single dispatch -- 單分派一種 [generic function](#term-generic-function) 分派形式,其實現是基于單個參數的類型來選擇的。
slice -- 切片通常只包含了特定 [sequence](#term-sequence) 的一部分的對象。切片是通過使用下標標記來創建的,在 `[]` 中給出幾個以冒號分隔的數字,例如 `variable_name[1:3:5]`。方括號(下標)標記在內部使用 [`slice`](library/functions.xhtml#slice "slice") 對象。
special method -- 特殊方法一種由 Python 隱式調用的方法,用來對某個類型執行特定操作例如相加等等。這種方法的名稱的首尾都為雙下劃線。特殊方法的文檔參見 [特殊方法名稱](reference/datamodel.xhtml#specialnames)。
statement -- 語句語句是程序段(一個代碼“塊”)的組成單位。一條語句可以是一個 [expression](#term-expression) 或某個帶有關鍵字的結構,例如 [`if`](reference/compound_stmts.xhtml#if)、[`while`](reference/compound_stmts.xhtml#while) 或 [`for`](reference/compound_stmts.xhtml#for)。
struct sequence -- 結構序列具有命名元素的元組。結構序列所暴露的接口類似于 [named tuple](#term-named-tuple),其元素既可通過索引也可作為屬性來訪問。不過,它們沒有任何具名元組的方法,例如 [`_make()`](library/collections.xhtml#collections.somenamedtuple._make "collections.somenamedtuple._make") 或 [`_asdict()`](library/collections.xhtml#collections.somenamedtuple._asdict "collections.somenamedtuple._asdict")。結構序列的例子包括 [`sys.float_info`](library/sys.xhtml#sys.float_info "sys.float_info") 以及 [`os.stat()`](library/os.xhtml#os.stat "os.stat") 的返回值。
text encoding -- 文本編碼用于將Unicode字符串編碼為字節串的編碼器。
text file -- 文本文件一種能夠讀寫 [`str`](library/stdtypes.xhtml#str "str") 對象的 [file object](#term-file-object)。通常一個文本文件實際是訪問一個面向字節的數據流并自動處理 [text encoding](#term-text-encoding)。文本文件的例子包括以文本模式(`'r'` 或 `'w'`)打開的文件、[`sys.stdin`](library/sys.xhtml#sys.stdin "sys.stdin")、[`sys.stdout`](library/sys.xhtml#sys.stdout "sys.stdout") 以及 [`io.StringIO`](library/io.xhtml#io.StringIO "io.StringIO") 的實例。
另請參看 [binary file](#term-binary-file) 了解能夠讀寫 [字節類對象](#term-bytes-like-object) 的文件對象。
triple-quoted string -- 三引號字符串首尾各帶三個連續雙引號(")或者單引號(')的字符串。它們在功能上與首尾各用一個引號標注的字符串沒有什么不同,但是有多種用處。它們允許你在字符串內包含未經轉義的單引號和雙引號,并且可以跨越多行而無需使用連接符,在編寫文檔字符串時特別好用。
type -- 類型類型決定一個 Python 對象屬于什么種類;每個對象都具有一種類型。要知道對象的類型,可以訪問它的 [`__class__`](library/stdtypes.xhtml#instance.__class__ "instance.__class__") 屬性,或是通過 `type(obj)` 來獲取。
type alias -- 類型別名一個類型的同義詞,創建方式是把類型賦值給特定的標識符。
類型別名的作用是簡化 [類型提示](#term-type-hint)。例如:
```
from typing import List, Tuple
def remove_gray_shades(
colors: List[Tuple[int, int, int]]) -> List[Tuple[int, int, int]]:
pass
```
可以這樣提高可讀性:
```
from typing import List, Tuple
Color = Tuple[int, int, int]
def remove_gray_shades(colors: List[Color]) -> List[Color]:
pass
```
參見 [`typing`](library/typing.xhtml#module-typing "typing: Support for type hints (see PEP 484).") 和 [**PEP 484**](https://www.python.org/dev/peps/pep-0484) \[https://www.python.org/dev/peps/pep-0484\],其中有對此功能的詳細描述。
type hint -- 類型提示[annotation](#term-annotation) 為變量、類屬性、函數的形參或返回值指定預期的類型。
類型提示屬于可選項,Python 不要求提供,但其可對靜態類型分析工具起作用,并可協助 IDE 實現代碼補全與重構。
全局變量、類屬性和函數的類型提示可以使用 [`typing.get_type_hints()`](library/typing.xhtml#typing.get_type_hints "typing.get_type_hints") 來訪問,但局部變量則不可以。
參見 [`typing`](library/typing.xhtml#module-typing "typing: Support for type hints (see PEP 484).") 和 [**PEP 484**](https://www.python.org/dev/peps/pep-0484) \[https://www.python.org/dev/peps/pep-0484\],其中有對此功能的詳細描述。
universal newlines -- 通用換行一種解讀文本流的方式,將以下所有符號都識別為行結束標志:Unix 的行結束約定 `'\n'`、Windows 的約定 `'\r\n'` 以及舊版 Macintosh 的約定 `'\r'`。參見 [**PEP 278**](https://www.python.org/dev/peps/pep-0278) \[https://www.python.org/dev/peps/pep-0278\] 和 [**PEP 3116**](https://www.python.org/dev/peps/pep-3116) \[https://www.python.org/dev/peps/pep-3116\] 和 [`bytes.splitlines()`](library/stdtypes.xhtml#bytes.splitlines "bytes.splitlines") 了解更多用法說明。
variable annotation -- 變量標注對變量或類屬性的 [annotation](#term-annotation)。
在標注變量或類屬性時,還可選擇為其賦值:
```
class C:
field: 'annotation'
```
變量標注通常被用作 [類型提示](#term-type-hint):例如以下變量預期接受 [`int`](library/functions.xhtml#int "int") 類型的值:
```
count: int = 0
```
變量標注語法的詳細解釋見 [帶標注的賦值語句](reference/simple_stmts.xhtml#annassign) 一節。
請參看 [function annotation](#term-function-annotation)、[**PEP 484**](https://www.python.org/dev/peps/pep-0484) \[https://www.python.org/dev/peps/pep-0484\] 和 [**PEP 526**](https://www.python.org/dev/peps/pep-0526) \[https://www.python.org/dev/peps/pep-0526\],其中對此功能有詳細描述。
virtual environment -- 虛擬環境一種采用協作式隔離的運行時環境,允許 Python 用戶和應用程序在安裝和升級 Python 分發包時不會干擾到同一系統上運行的其他 Python 應用程序的行為。
另參見 [`venv`](library/venv.xhtml#module-venv "venv: Creation of virtual environments.")。
virtual machine -- 虛擬機一臺完全通過軟件定義的計算機。Python 虛擬機可執行字節碼編譯器所生成的 [bytecode](#term-bytecode)。
Zen of Python -- Python 之禪列出 Python 設計的原則與哲學,有助于理解與使用這種語言。查看其具體內容可在交互模式提示符中輸入 "`import this`"。
### 導航
- [索引](genindex.xhtml "總目錄")
- [模塊](py-modindex.xhtml "Python 模塊索引") |
- [下一頁](about.xhtml "文檔說明") |
- [上一頁](faq/installed.xhtml "“為什么我的電腦上安裝了 Python ?”") |
- 
- [Python](https://www.python.org/) ?
- zh\_CN 3.7.3 [文檔](index.xhtml) ?
- $('.inline-search').show(0); |
? [版權所有](copyright.xhtml) 2001-2019, Python Software Foundation.
Python 軟件基金會是一個非盈利組織。 [請捐助。](https://www.python.org/psf/donations/)
最后更新于 5月 21, 2019. [發現了問題](bugs.xhtml)?
使用[Sphinx](http://sphinx.pocoo.org/)1.8.4 創建。
- Python文檔內容
- Python 有什么新變化?
- Python 3.7 有什么新變化
- 摘要 - 發布重點
- 新的特性
- 其他語言特性修改
- 新增模塊
- 改進的模塊
- C API 的改變
- 構建的改變
- 性能優化
- 其他 CPython 實現的改變
- 已棄用的 Python 行為
- 已棄用的 Python 模塊、函數和方法
- 已棄用的 C API 函數和類型
- 平臺支持的移除
- API 與特性的移除
- 移除的模塊
- Windows 專屬的改變
- 移植到 Python 3.7
- Python 3.7.1 中的重要變化
- Python 3.7.2 中的重要變化
- Python 3.6 有什么新變化A
- 摘要 - 發布重點
- 新的特性
- 其他語言特性修改
- 新增模塊
- 改進的模塊
- 性能優化
- Build and C API Changes
- 其他改進
- 棄用
- 移除
- 移植到Python 3.6
- Python 3.6.2 中的重要變化
- Python 3.6.4 中的重要變化
- Python 3.6.5 中的重要變化
- Python 3.6.7 中的重要變化
- Python 3.5 有什么新變化
- 摘要 - 發布重點
- 新的特性
- 其他語言特性修改
- 新增模塊
- 改進的模塊
- Other module-level changes
- 性能優化
- Build and C API Changes
- 棄用
- 移除
- Porting to Python 3.5
- Notable changes in Python 3.5.4
- What's New In Python 3.4
- 摘要 - 發布重點
- 新的特性
- 新增模塊
- 改進的模塊
- CPython Implementation Changes
- 棄用
- 移除
- Porting to Python 3.4
- Changed in 3.4.3
- What's New In Python 3.3
- 摘要 - 發布重點
- PEP 405: Virtual Environments
- PEP 420: Implicit Namespace Packages
- PEP 3118: New memoryview implementation and buffer protocol documentation
- PEP 393: Flexible String Representation
- PEP 397: Python Launcher for Windows
- PEP 3151: Reworking the OS and IO exception hierarchy
- PEP 380: Syntax for Delegating to a Subgenerator
- PEP 409: Suppressing exception context
- PEP 414: Explicit Unicode literals
- PEP 3155: Qualified name for classes and functions
- PEP 412: Key-Sharing Dictionary
- PEP 362: Function Signature Object
- PEP 421: Adding sys.implementation
- Using importlib as the Implementation of Import
- 其他語言特性修改
- A Finer-Grained Import Lock
- Builtin functions and types
- 新增模塊
- 改進的模塊
- 性能優化
- Build and C API Changes
- 棄用
- Porting to Python 3.3
- What's New In Python 3.2
- PEP 384: Defining a Stable ABI
- PEP 389: Argparse Command Line Parsing Module
- PEP 391: Dictionary Based Configuration for Logging
- PEP 3148: The concurrent.futures module
- PEP 3147: PYC Repository Directories
- PEP 3149: ABI Version Tagged .so Files
- PEP 3333: Python Web Server Gateway Interface v1.0.1
- 其他語言特性修改
- New, Improved, and Deprecated Modules
- 多線程
- 性能優化
- Unicode
- Codecs
- 文檔
- IDLE
- Code Repository
- Build and C API Changes
- Porting to Python 3.2
- What's New In Python 3.1
- PEP 372: Ordered Dictionaries
- PEP 378: Format Specifier for Thousands Separator
- 其他語言特性修改
- New, Improved, and Deprecated Modules
- 性能優化
- IDLE
- Build and C API Changes
- Porting to Python 3.1
- What's New In Python 3.0
- Common Stumbling Blocks
- Overview Of Syntax Changes
- Changes Already Present In Python 2.6
- Library Changes
- PEP 3101: A New Approach To String Formatting
- Changes To Exceptions
- Miscellaneous Other Changes
- Build and C API Changes
- 性能
- Porting To Python 3.0
- What's New in Python 2.7
- The Future for Python 2.x
- Changes to the Handling of Deprecation Warnings
- Python 3.1 Features
- PEP 372: Adding an Ordered Dictionary to collections
- PEP 378: Format Specifier for Thousands Separator
- PEP 389: The argparse Module for Parsing Command Lines
- PEP 391: Dictionary-Based Configuration For Logging
- PEP 3106: Dictionary Views
- PEP 3137: The memoryview Object
- 其他語言特性修改
- New and Improved Modules
- Build and C API Changes
- Other Changes and Fixes
- Porting to Python 2.7
- New Features Added to Python 2.7 Maintenance Releases
- Acknowledgements
- Python 2.6 有什么新變化
- Python 3.0
- Changes to the Development Process
- PEP 343: The 'with' statement
- PEP 366: Explicit Relative Imports From a Main Module
- PEP 370: Per-user site-packages Directory
- PEP 371: The multiprocessing Package
- PEP 3101: Advanced String Formatting
- PEP 3105: print As a Function
- PEP 3110: Exception-Handling Changes
- PEP 3112: Byte Literals
- PEP 3116: New I/O Library
- PEP 3118: Revised Buffer Protocol
- PEP 3119: Abstract Base Classes
- PEP 3127: Integer Literal Support and Syntax
- PEP 3129: Class Decorators
- PEP 3141: A Type Hierarchy for Numbers
- 其他語言特性修改
- New and Improved Modules
- Deprecations and Removals
- Build and C API Changes
- Porting to Python 2.6
- Acknowledgements
- What's New in Python 2.5
- PEP 308: Conditional Expressions
- PEP 309: Partial Function Application
- PEP 314: Metadata for Python Software Packages v1.1
- PEP 328: Absolute and Relative Imports
- PEP 338: Executing Modules as Scripts
- PEP 341: Unified try/except/finally
- PEP 342: New Generator Features
- PEP 343: The 'with' statement
- PEP 352: Exceptions as New-Style Classes
- PEP 353: Using ssize_t as the index type
- PEP 357: The 'index' method
- 其他語言特性修改
- New, Improved, and Removed Modules
- Build and C API Changes
- Porting to Python 2.5
- Acknowledgements
- What's New in Python 2.4
- PEP 218: Built-In Set Objects
- PEP 237: Unifying Long Integers and Integers
- PEP 289: Generator Expressions
- PEP 292: Simpler String Substitutions
- PEP 318: Decorators for Functions and Methods
- PEP 322: Reverse Iteration
- PEP 324: New subprocess Module
- PEP 327: Decimal Data Type
- PEP 328: Multi-line Imports
- PEP 331: Locale-Independent Float/String Conversions
- 其他語言特性修改
- New, Improved, and Deprecated Modules
- Build and C API Changes
- Porting to Python 2.4
- Acknowledgements
- What's New in Python 2.3
- PEP 218: A Standard Set Datatype
- PEP 255: Simple Generators
- PEP 263: Source Code Encodings
- PEP 273: Importing Modules from ZIP Archives
- PEP 277: Unicode file name support for Windows NT
- PEP 278: Universal Newline Support
- PEP 279: enumerate()
- PEP 282: The logging Package
- PEP 285: A Boolean Type
- PEP 293: Codec Error Handling Callbacks
- PEP 301: Package Index and Metadata for Distutils
- PEP 302: New Import Hooks
- PEP 305: Comma-separated Files
- PEP 307: Pickle Enhancements
- Extended Slices
- 其他語言特性修改
- New, Improved, and Deprecated Modules
- Pymalloc: A Specialized Object Allocator
- Build and C API Changes
- Other Changes and Fixes
- Porting to Python 2.3
- Acknowledgements
- What's New in Python 2.2
- 概述
- PEPs 252 and 253: Type and Class Changes
- PEP 234: Iterators
- PEP 255: Simple Generators
- PEP 237: Unifying Long Integers and Integers
- PEP 238: Changing the Division Operator
- Unicode Changes
- PEP 227: Nested Scopes
- New and Improved Modules
- Interpreter Changes and Fixes
- Other Changes and Fixes
- Acknowledgements
- What's New in Python 2.1
- 概述
- PEP 227: Nested Scopes
- PEP 236: future Directives
- PEP 207: Rich Comparisons
- PEP 230: Warning Framework
- PEP 229: New Build System
- PEP 205: Weak References
- PEP 232: Function Attributes
- PEP 235: Importing Modules on Case-Insensitive Platforms
- PEP 217: Interactive Display Hook
- PEP 208: New Coercion Model
- PEP 241: Metadata in Python Packages
- New and Improved Modules
- Other Changes and Fixes
- Acknowledgements
- What's New in Python 2.0
- 概述
- What About Python 1.6?
- New Development Process
- Unicode
- 列表推導式
- Augmented Assignment
- 字符串的方法
- Garbage Collection of Cycles
- Other Core Changes
- Porting to 2.0
- Extending/Embedding Changes
- Distutils: Making Modules Easy to Install
- XML Modules
- Module changes
- New modules
- IDLE Improvements
- Deleted and Deprecated Modules
- Acknowledgements
- 更新日志
- Python 下一版
- Python 3.7.3 最終版
- Python 3.7.3 發布候選版 1
- Python 3.7.2 最終版
- Python 3.7.2 發布候選版 1
- Python 3.7.1 最終版
- Python 3.7.1 RC 2版本
- Python 3.7.1 發布候選版 1
- Python 3.7.0 正式版
- Python 3.7.0 release candidate 1
- Python 3.7.0 beta 5
- Python 3.7.0 beta 4
- Python 3.7.0 beta 3
- Python 3.7.0 beta 2
- Python 3.7.0 beta 1
- Python 3.7.0 alpha 4
- Python 3.7.0 alpha 3
- Python 3.7.0 alpha 2
- Python 3.7.0 alpha 1
- Python 3.6.6 final
- Python 3.6.6 RC 1
- Python 3.6.5 final
- Python 3.6.5 release candidate 1
- Python 3.6.4 final
- Python 3.6.4 release candidate 1
- Python 3.6.3 final
- Python 3.6.3 release candidate 1
- Python 3.6.2 final
- Python 3.6.2 release candidate 2
- Python 3.6.2 release candidate 1
- Python 3.6.1 final
- Python 3.6.1 release candidate 1
- Python 3.6.0 final
- Python 3.6.0 release candidate 2
- Python 3.6.0 release candidate 1
- Python 3.6.0 beta 4
- Python 3.6.0 beta 3
- Python 3.6.0 beta 2
- Python 3.6.0 beta 1
- Python 3.6.0 alpha 4
- Python 3.6.0 alpha 3
- Python 3.6.0 alpha 2
- Python 3.6.0 alpha 1
- Python 3.5.5 final
- Python 3.5.5 release candidate 1
- Python 3.5.4 final
- Python 3.5.4 release candidate 1
- Python 3.5.3 final
- Python 3.5.3 release candidate 1
- Python 3.5.2 final
- Python 3.5.2 release candidate 1
- Python 3.5.1 final
- Python 3.5.1 release candidate 1
- Python 3.5.0 final
- Python 3.5.0 release candidate 4
- Python 3.5.0 release candidate 3
- Python 3.5.0 release candidate 2
- Python 3.5.0 release candidate 1
- Python 3.5.0 beta 4
- Python 3.5.0 beta 3
- Python 3.5.0 beta 2
- Python 3.5.0 beta 1
- Python 3.5.0 alpha 4
- Python 3.5.0 alpha 3
- Python 3.5.0 alpha 2
- Python 3.5.0 alpha 1
- Python 教程
- 課前甜點
- 使用 Python 解釋器
- 調用解釋器
- 解釋器的運行環境
- Python 的非正式介紹
- Python 作為計算器使用
- 走向編程的第一步
- 其他流程控制工具
- if 語句
- for 語句
- range() 函數
- break 和 continue 語句,以及循環中的 else 子句
- pass 語句
- 定義函數
- 函數定義的更多形式
- 小插曲:編碼風格
- 數據結構
- 列表的更多特性
- del 語句
- 元組和序列
- 集合
- 字典
- 循環的技巧
- 深入條件控制
- 序列和其它類型的比較
- 模塊
- 有關模塊的更多信息
- 標準模塊
- dir() 函數
- 包
- 輸入輸出
- 更漂亮的輸出格式
- 讀寫文件
- 錯誤和異常
- 語法錯誤
- 異常
- 處理異常
- 拋出異常
- 用戶自定義異常
- 定義清理操作
- 預定義的清理操作
- 類
- 名稱和對象
- Python 作用域和命名空間
- 初探類
- 補充說明
- 繼承
- 私有變量
- 雜項說明
- 迭代器
- 生成器
- 生成器表達式
- 標準庫簡介
- 操作系統接口
- 文件通配符
- 命令行參數
- 錯誤輸出重定向和程序終止
- 字符串模式匹配
- 數學
- 互聯網訪問
- 日期和時間
- 數據壓縮
- 性能測量
- 質量控制
- 自帶電池
- 標準庫簡介 —— 第二部分
- 格式化輸出
- 模板
- 使用二進制數據記錄格式
- 多線程
- 日志
- 弱引用
- 用于操作列表的工具
- 十進制浮點運算
- 虛擬環境和包
- 概述
- 創建虛擬環境
- 使用pip管理包
- 接下來?
- 交互式編輯和編輯歷史
- Tab 補全和編輯歷史
- 默認交互式解釋器的替代品
- 浮點算術:爭議和限制
- 表示性錯誤
- 附錄
- 交互模式
- 安裝和使用 Python
- 命令行與環境
- 命令行
- 環境變量
- 在Unix平臺中使用Python
- 獲取最新版本的Python
- 構建Python
- 與Python相關的路徑和文件
- 雜項
- 編輯器和集成開發環境
- 在Windows上使用 Python
- 完整安裝程序
- Microsoft Store包
- nuget.org 安裝包
- 可嵌入的包
- 替代捆綁包
- 配置Python
- 適用于Windows的Python啟動器
- 查找模塊
- 附加模塊
- 在Windows上編譯Python
- 其他平臺
- 在蘋果系統上使用 Python
- 獲取和安裝 MacPython
- IDE
- 安裝額外的 Python 包
- Mac 上的圖形界面編程
- 在 Mac 上分發 Python 應用程序
- 其他資源
- Python 語言參考
- 概述
- 其他實現
- 標注
- 詞法分析
- 行結構
- 其他形符
- 標識符和關鍵字
- 字面值
- 運算符
- 分隔符
- 數據模型
- 對象、值與類型
- 標準類型層級結構
- 特殊方法名稱
- 協程
- 執行模型
- 程序的結構
- 命名與綁定
- 異常
- 導入系統
- importlib
- 包
- 搜索
- 加載
- 基于路徑的查找器
- 替換標準導入系統
- Package Relative Imports
- 有關 main 的特殊事項
- 開放問題項
- 參考文獻
- 表達式
- 算術轉換
- 原子
- 原型
- await 表達式
- 冪運算符
- 一元算術和位運算
- 二元算術運算符
- 移位運算
- 二元位運算
- 比較運算
- 布爾運算
- 條件表達式
- lambda 表達式
- 表達式列表
- 求值順序
- 運算符優先級
- 簡單語句
- 表達式語句
- 賦值語句
- assert 語句
- pass 語句
- del 語句
- return 語句
- yield 語句
- raise 語句
- break 語句
- continue 語句
- import 語句
- global 語句
- nonlocal 語句
- 復合語句
- if 語句
- while 語句
- for 語句
- try 語句
- with 語句
- 函數定義
- 類定義
- 協程
- 最高層級組件
- 完整的 Python 程序
- 文件輸入
- 交互式輸入
- 表達式輸入
- 完整的語法規范
- Python 標準庫
- 概述
- 可用性注釋
- 內置函數
- 內置常量
- 由 site 模塊添加的常量
- 內置類型
- 邏輯值檢測
- 布爾運算 — and, or, not
- 比較
- 數字類型 — int, float, complex
- 迭代器類型
- 序列類型 — list, tuple, range
- 文本序列類型 — str
- 二進制序列類型 — bytes, bytearray, memoryview
- 集合類型 — set, frozenset
- 映射類型 — dict
- 上下文管理器類型
- 其他內置類型
- 特殊屬性
- 內置異常
- 基類
- 具體異常
- 警告
- 異常層次結構
- 文本處理服務
- string — 常見的字符串操作
- re — 正則表達式操作
- 模塊 difflib 是一個計算差異的助手
- textwrap — Text wrapping and filling
- unicodedata — Unicode 數據庫
- stringprep — Internet String Preparation
- readline — GNU readline interface
- rlcompleter — GNU readline的完成函數
- 二進制數據服務
- struct — Interpret bytes as packed binary data
- codecs — Codec registry and base classes
- 數據類型
- datetime — 基礎日期/時間數據類型
- calendar — General calendar-related functions
- collections — 容器數據類型
- collections.abc — 容器的抽象基類
- heapq — 堆隊列算法
- bisect — Array bisection algorithm
- array — Efficient arrays of numeric values
- weakref — 弱引用
- types — Dynamic type creation and names for built-in types
- copy — 淺層 (shallow) 和深層 (deep) 復制操作
- pprint — 數據美化輸出
- reprlib — Alternate repr() implementation
- enum — Support for enumerations
- 數字和數學模塊
- numbers — 數字的抽象基類
- math — 數學函數
- cmath — Mathematical functions for complex numbers
- decimal — 十進制定點和浮點運算
- fractions — 分數
- random — 生成偽隨機數
- statistics — Mathematical statistics functions
- 函數式編程模塊
- itertools — 為高效循環而創建迭代器的函數
- functools — 高階函數和可調用對象上的操作
- operator — 標準運算符替代函數
- 文件和目錄訪問
- pathlib — 面向對象的文件系統路徑
- os.path — 常見路徑操作
- fileinput — Iterate over lines from multiple input streams
- stat — Interpreting stat() results
- filecmp — File and Directory Comparisons
- tempfile — Generate temporary files and directories
- glob — Unix style pathname pattern expansion
- fnmatch — Unix filename pattern matching
- linecache — Random access to text lines
- shutil — High-level file operations
- macpath — Mac OS 9 路徑操作函數
- 數據持久化
- pickle —— Python 對象序列化
- copyreg — Register pickle support functions
- shelve — Python object persistence
- marshal — Internal Python object serialization
- dbm — Interfaces to Unix “databases”
- sqlite3 — SQLite 數據庫 DB-API 2.0 接口模塊
- 數據壓縮和存檔
- zlib — 與 gzip 兼容的壓縮
- gzip — 對 gzip 格式的支持
- bz2 — 對 bzip2 壓縮算法的支持
- lzma — 用 LZMA 算法壓縮
- zipfile — 在 ZIP 歸檔中工作
- tarfile — Read and write tar archive files
- 文件格式
- csv — CSV 文件讀寫
- configparser — Configuration file parser
- netrc — netrc file processing
- xdrlib — Encode and decode XDR data
- plistlib — Generate and parse Mac OS X .plist files
- 加密服務
- hashlib — 安全哈希與消息摘要
- hmac — 基于密鑰的消息驗證
- secrets — Generate secure random numbers for managing secrets
- 通用操作系統服務
- os — 操作系統接口模塊
- io — 處理流的核心工具
- time — 時間的訪問和轉換
- argparse — 命令行選項、參數和子命令解析器
- getopt — C-style parser for command line options
- 模塊 logging — Python 的日志記錄工具
- logging.config — 日志記錄配置
- logging.handlers — Logging handlers
- getpass — 便攜式密碼輸入工具
- curses — 終端字符單元顯示的處理
- curses.textpad — Text input widget for curses programs
- curses.ascii — Utilities for ASCII characters
- curses.panel — A panel stack extension for curses
- platform — Access to underlying platform's identifying data
- errno — Standard errno system symbols
- ctypes — Python 的外部函數庫
- 并發執行
- threading — 基于線程的并行
- multiprocessing — 基于進程的并行
- concurrent 包
- concurrent.futures — 啟動并行任務
- subprocess — 子進程管理
- sched — 事件調度器
- queue — 一個同步的隊列類
- _thread — 底層多線程 API
- _dummy_thread — _thread 的替代模塊
- dummy_threading — 可直接替代 threading 模塊。
- contextvars — Context Variables
- Context Variables
- Manual Context Management
- asyncio support
- 網絡和進程間通信
- asyncio — 異步 I/O
- socket — 底層網絡接口
- ssl — TLS/SSL wrapper for socket objects
- select — Waiting for I/O completion
- selectors — 高級 I/O 復用庫
- asyncore — 異步socket處理器
- asynchat — 異步 socket 指令/響應 處理器
- signal — Set handlers for asynchronous events
- mmap — Memory-mapped file support
- 互聯網數據處理
- email — 電子郵件與 MIME 處理包
- json — JSON 編碼和解碼器
- mailcap — Mailcap file handling
- mailbox — Manipulate mailboxes in various formats
- mimetypes — Map filenames to MIME types
- base64 — Base16, Base32, Base64, Base85 數據編碼
- binhex — 對binhex4文件進行編碼和解碼
- binascii — 二進制和 ASCII 碼互轉
- quopri — Encode and decode MIME quoted-printable data
- uu — Encode and decode uuencode files
- 結構化標記處理工具
- html — 超文本標記語言支持
- html.parser — 簡單的 HTML 和 XHTML 解析器
- html.entities — HTML 一般實體的定義
- XML處理模塊
- xml.etree.ElementTree — The ElementTree XML API
- xml.dom — The Document Object Model API
- xml.dom.minidom — Minimal DOM implementation
- xml.dom.pulldom — Support for building partial DOM trees
- xml.sax — Support for SAX2 parsers
- xml.sax.handler — Base classes for SAX handlers
- xml.sax.saxutils — SAX Utilities
- xml.sax.xmlreader — Interface for XML parsers
- xml.parsers.expat — Fast XML parsing using Expat
- 互聯網協議和支持
- webbrowser — 方便的Web瀏覽器控制器
- cgi — Common Gateway Interface support
- cgitb — Traceback manager for CGI scripts
- wsgiref — WSGI Utilities and Reference Implementation
- urllib — URL 處理模塊
- urllib.request — 用于打開 URL 的可擴展庫
- urllib.response — Response classes used by urllib
- urllib.parse — Parse URLs into components
- urllib.error — Exception classes raised by urllib.request
- urllib.robotparser — Parser for robots.txt
- http — HTTP 模塊
- http.client — HTTP協議客戶端
- ftplib — FTP protocol client
- poplib — POP3 protocol client
- imaplib — IMAP4 protocol client
- nntplib — NNTP protocol client
- smtplib —SMTP協議客戶端
- smtpd — SMTP Server
- telnetlib — Telnet client
- uuid — UUID objects according to RFC 4122
- socketserver — A framework for network servers
- http.server — HTTP 服務器
- http.cookies — HTTP state management
- http.cookiejar — Cookie handling for HTTP clients
- xmlrpc — XMLRPC 服務端與客戶端模塊
- xmlrpc.client — XML-RPC client access
- xmlrpc.server — Basic XML-RPC servers
- ipaddress — IPv4/IPv6 manipulation library
- 多媒體服務
- audioop — Manipulate raw audio data
- aifc — Read and write AIFF and AIFC files
- sunau — 讀寫 Sun AU 文件
- wave — 讀寫WAV格式文件
- chunk — Read IFF chunked data
- colorsys — Conversions between color systems
- imghdr — 推測圖像類型
- sndhdr — 推測聲音文件的類型
- ossaudiodev — Access to OSS-compatible audio devices
- 國際化
- gettext — 多語種國際化服務
- locale — 國際化服務
- 程序框架
- turtle — 海龜繪圖
- cmd — 支持面向行的命令解釋器
- shlex — Simple lexical analysis
- Tk圖形用戶界面(GUI)
- tkinter — Tcl/Tk的Python接口
- tkinter.ttk — Tk themed widgets
- tkinter.tix — Extension widgets for Tk
- tkinter.scrolledtext — 滾動文字控件
- IDLE
- 其他圖形用戶界面(GUI)包
- 開發工具
- typing — 類型標注支持
- pydoc — Documentation generator and online help system
- doctest — Test interactive Python examples
- unittest — 單元測試框架
- unittest.mock — mock object library
- unittest.mock 上手指南
- 2to3 - 自動將 Python 2 代碼轉為 Python 3 代碼
- test — Regression tests package for Python
- test.support — Utilities for the Python test suite
- test.support.script_helper — Utilities for the Python execution tests
- 調試和分析
- bdb — Debugger framework
- faulthandler — Dump the Python traceback
- pdb — The Python Debugger
- The Python Profilers
- timeit — 測量小代碼片段的執行時間
- trace — Trace or track Python statement execution
- tracemalloc — Trace memory allocations
- 軟件打包和分發
- distutils — 構建和安裝 Python 模塊
- ensurepip — Bootstrapping the pip installer
- venv — 創建虛擬環境
- zipapp — Manage executable Python zip archives
- Python運行時服務
- sys — 系統相關的參數和函數
- sysconfig — Provide access to Python's configuration information
- builtins — 內建對象
- main — 頂層腳本環境
- warnings — Warning control
- dataclasses — 數據類
- contextlib — Utilities for with-statement contexts
- abc — 抽象基類
- atexit — 退出處理器
- traceback — Print or retrieve a stack traceback
- future — Future 語句定義
- gc — 垃圾回收器接口
- inspect — 檢查對象
- site — Site-specific configuration hook
- 自定義 Python 解釋器
- code — Interpreter base classes
- codeop — Compile Python code
- 導入模塊
- zipimport — Import modules from Zip archives
- pkgutil — Package extension utility
- modulefinder — 查找腳本使用的模塊
- runpy — Locating and executing Python modules
- importlib — The implementation of import
- Python 語言服務
- parser — Access Python parse trees
- ast — 抽象語法樹
- symtable — Access to the compiler's symbol tables
- symbol — 與 Python 解析樹一起使用的常量
- token — 與Python解析樹一起使用的常量
- keyword — 檢驗Python關鍵字
- tokenize — Tokenizer for Python source
- tabnanny — 模糊縮進檢測
- pyclbr — Python class browser support
- py_compile — Compile Python source files
- compileall — Byte-compile Python libraries
- dis — Python 字節碼反匯編器
- pickletools — Tools for pickle developers
- 雜項服務
- formatter — Generic output formatting
- Windows系統相關模塊
- msilib — Read and write Microsoft Installer files
- msvcrt — Useful routines from the MS VC++ runtime
- winreg — Windows 注冊表訪問
- winsound — Sound-playing interface for Windows
- Unix 專有服務
- posix — The most common POSIX system calls
- pwd — 用戶密碼數據庫
- spwd — The shadow password database
- grp — The group database
- crypt — Function to check Unix passwords
- termios — POSIX style tty control
- tty — 終端控制功能
- pty — Pseudo-terminal utilities
- fcntl — The fcntl and ioctl system calls
- pipes — Interface to shell pipelines
- resource — Resource usage information
- nis — Interface to Sun's NIS (Yellow Pages)
- Unix syslog 庫例程
- 被取代的模塊
- optparse — Parser for command line options
- imp — Access the import internals
- 未創建文檔的模塊
- 平臺特定模塊
- 擴展和嵌入 Python 解釋器
- 推薦的第三方工具
- 不使用第三方工具創建擴展
- 使用 C 或 C++ 擴展 Python
- 自定義擴展類型:教程
- 定義擴展類型:已分類主題
- 構建C/C++擴展
- 在Windows平臺編譯C和C++擴展
- 在更大的應用程序中嵌入 CPython 運行時
- Embedding Python in Another Application
- Python/C API 參考手冊
- 概述
- 代碼標準
- 包含文件
- 有用的宏
- 對象、類型和引用計數
- 異常
- 嵌入Python
- 調試構建
- 穩定的應用程序二進制接口
- The Very High Level Layer
- Reference Counting
- 異常處理
- Printing and clearing
- 拋出異常
- Issuing warnings
- Querying the error indicator
- Signal Handling
- Exception Classes
- Exception Objects
- Unicode Exception Objects
- Recursion Control
- 標準異常
- 標準警告類別
- 工具
- 操作系統實用程序
- 系統功能
- 過程控制
- 導入模塊
- Data marshalling support
- 語句解釋及變量編譯
- 字符串轉換與格式化
- 反射
- 編解碼器注冊與支持功能
- 抽象對象層
- Object Protocol
- 數字協議
- Sequence Protocol
- Mapping Protocol
- 迭代器協議
- 緩沖協議
- Old Buffer Protocol
- 具體的對象層
- 基本對象
- 數值對象
- 序列對象
- 容器對象
- 函數對象
- 其他對象
- Initialization, Finalization, and Threads
- 在Python初始化之前
- 全局配置變量
- Initializing and finalizing the interpreter
- Process-wide parameters
- Thread State and the Global Interpreter Lock
- Sub-interpreter support
- Asynchronous Notifications
- Profiling and Tracing
- Advanced Debugger Support
- Thread Local Storage Support
- 內存管理
- 概述
- 原始內存接口
- Memory Interface
- 對象分配器
- 默認內存分配器
- Customize Memory Allocators
- The pymalloc allocator
- tracemalloc C API
- 示例
- 對象實現支持
- 在堆中分配對象
- Common Object Structures
- Type 對象
- Number Object Structures
- Mapping Object Structures
- Sequence Object Structures
- Buffer Object Structures
- Async Object Structures
- 使對象類型支持循環垃圾回收
- API 和 ABI 版本管理
- 分發 Python 模塊
- 關鍵術語
- 開源許可與協作
- 安裝工具
- 閱讀指南
- 我該如何...?
- ...為我的項目選擇一個名字?
- ...創建和分發二進制擴展?
- 安裝 Python 模塊
- 關鍵術語
- 基本使用
- 我應如何 ...?
- ... 在 Python 3.4 之前的 Python 版本中安裝 pip ?
- ... 只為當前用戶安裝軟件包?
- ... 安裝科學計算類 Python 軟件包?
- ... 使用并行安裝的多個 Python 版本?
- 常見的安裝問題
- 在 Linux 的系統 Python 版本上安裝
- 未安裝 pip
- 安裝二進制編譯擴展
- Python 常用指引
- 將 Python 2 代碼遷移到 Python 3
- 簡要說明
- 詳情
- 將擴展模塊移植到 Python 3
- 條件編譯
- 對象API的更改
- 模塊初始化和狀態
- CObject 替換為 Capsule
- 其他選項
- Curses Programming with Python
- What is curses?
- Starting and ending a curses application
- Windows and Pads
- Displaying Text
- User Input
- For More Information
- 實現描述器
- 摘要
- 定義和簡介
- 描述器協議
- 發起調用描述符
- 描述符示例
- Properties
- 函數和方法
- Static Methods and Class Methods
- 函數式編程指引
- 概述
- 迭代器
- 生成器表達式和列表推導式
- 生成器
- 內置函數
- itertools 模塊
- The functools module
- Small functions and the lambda expression
- Revision History and Acknowledgements
- 引用文獻
- 日志 HOWTO
- 日志基礎教程
- 進階日志教程
- 日志級別
- 有用的處理程序
- 記錄日志中引發的異常
- 使用任意對象作為消息
- 優化
- 日志操作手冊
- 在多個模塊中使用日志
- 在多線程中使用日志
- 使用多個日志處理器和多種格式化
- 在多個地方記錄日志
- 日志服務器配置示例
- 處理日志處理器的阻塞
- Sending and receiving logging events across a network
- Adding contextual information to your logging output
- Logging to a single file from multiple processes
- Using file rotation
- Use of alternative formatting styles
- Customizing LogRecord
- Subclassing QueueHandler - a ZeroMQ example
- Subclassing QueueListener - a ZeroMQ example
- An example dictionary-based configuration
- Using a rotator and namer to customize log rotation processing
- A more elaborate multiprocessing example
- Inserting a BOM into messages sent to a SysLogHandler
- Implementing structured logging
- Customizing handlers with dictConfig()
- Using particular formatting styles throughout your application
- Configuring filters with dictConfig()
- Customized exception formatting
- Speaking logging messages
- Buffering logging messages and outputting them conditionally
- Formatting times using UTC (GMT) via configuration
- Using a context manager for selective logging
- 正則表達式HOWTO
- 概述
- 簡單模式
- 使用正則表達式
- 更多模式能力
- 修改字符串
- 常見問題
- 反饋
- 套接字編程指南
- 套接字
- 創建套接字
- 使用一個套接字
- 斷開連接
- 非阻塞的套接字
- 排序指南
- 基本排序
- 關鍵函數
- Operator 模塊函數
- 升序和降序
- 排序穩定性和排序復雜度
- 使用裝飾-排序-去裝飾的舊方法
- 使用 cmp 參數的舊方法
- 其它
- Unicode 指南
- Unicode 概述
- Python's Unicode Support
- Reading and Writing Unicode Data
- Acknowledgements
- 如何使用urllib包獲取網絡資源
- 概述
- Fetching URLs
- 處理異常
- info and geturl
- Openers and Handlers
- Basic Authentication
- Proxies
- Sockets and Layers
- 腳注
- Argparse 教程
- 概念
- 基礎
- 位置參數介紹
- Introducing Optional arguments
- Combining Positional and Optional arguments
- Getting a little more advanced
- Conclusion
- ipaddress模塊介紹
- 創建 Address/Network/Interface 對象
- 審查 Address/Network/Interface 對象
- Network 作為 Address 列表
- 比較
- 將IP地址與其他模塊一起使用
- 實例創建失敗時獲取更多詳細信息
- Argument Clinic How-To
- The Goals Of Argument Clinic
- Basic Concepts And Usage
- Converting Your First Function
- Advanced Topics
- 使用 DTrace 和 SystemTap 檢測CPython
- Enabling the static markers
- Static DTrace probes
- Static SystemTap markers
- Available static markers
- SystemTap Tapsets
- 示例
- Python 常見問題
- Python常見問題
- 一般信息
- 現實世界中的 Python
- 編程常見問題
- 一般問題
- 核心語言
- 數字和字符串
- 性能
- 序列(元組/列表)
- 對象
- 模塊
- 設計和歷史常見問題
- 為什么Python使用縮進來分組語句?
- 為什么簡單的算術運算得到奇怪的結果?
- 為什么浮點計算不準確?
- 為什么Python字符串是不可變的?
- 為什么必須在方法定義和調用中顯式使用“self”?
- 為什么不能在表達式中賦值?
- 為什么Python對某些功能(例如list.index())使用方法來實現,而其他功能(例如len(List))使用函數實現?
- 為什么 join()是一個字符串方法而不是列表或元組方法?
- 異常有多快?
- 為什么Python中沒有switch或case語句?
- 難道不能在解釋器中模擬線程,而非得依賴特定于操作系統的線程實現嗎?
- 為什么lambda表達式不能包含語句?
- 可以將Python編譯為機器代碼,C或其他語言嗎?
- Python如何管理內存?
- 為什么CPython不使用更傳統的垃圾回收方案?
- CPython退出時為什么不釋放所有內存?
- 為什么有單獨的元組和列表數據類型?
- 列表是如何在CPython中實現的?
- 字典是如何在CPython中實現的?
- 為什么字典key必須是不可變的?
- 為什么 list.sort() 沒有返回排序列表?
- 如何在Python中指定和實施接口規范?
- 為什么沒有goto?
- 為什么原始字符串(r-strings)不能以反斜杠結尾?
- 為什么Python沒有屬性賦值的“with”語句?
- 為什么 if/while/def/class語句需要冒號?
- 為什么Python在列表和元組的末尾允許使用逗號?
- 代碼庫和插件 FAQ
- 通用的代碼庫問題
- 通用任務
- 線程相關
- 輸入輸出
- 網絡 / Internet 編程
- 數據庫
- 數學和數字
- 擴展/嵌入常見問題
- 可以使用C語言中創建自己的函數嗎?
- 可以使用C++語言中創建自己的函數嗎?
- C很難寫,有沒有其他選擇?
- 如何從C執行任意Python語句?
- 如何從C中評估任意Python表達式?
- 如何從Python對象中提取C的值?
- 如何使用Py_BuildValue()創建任意長度的元組?
- 如何從C調用對象的方法?
- 如何捕獲PyErr_Print()(或打印到stdout / stderr的任何內容)的輸出?
- 如何從C訪問用Python編寫的模塊?
- 如何從Python接口到C ++對象?
- 我使用Setup文件添加了一個模塊,為什么make失敗了?
- 如何調試擴展?
- 我想在Linux系統上編譯一個Python模塊,但是缺少一些文件。為什么?
- 如何區分“輸入不完整”和“輸入無效”?
- 如何找到未定義的g++符號__builtin_new或__pure_virtual?
- 能否創建一個對象類,其中部分方法在C中實現,而其他方法在Python中實現(例如通過繼承)?
- Python在Windows上的常見問題
- 我怎樣在Windows下運行一個Python程序?
- 我怎么讓 Python 腳本可執行?
- 為什么有時候 Python 程序會啟動緩慢?
- 我怎樣使用Python腳本制作可執行文件?
- *.pyd 文件和DLL文件相同嗎?
- 我怎樣將Python嵌入一個Windows程序?
- 如何讓編輯器不要在我的 Python 源代碼中插入 tab ?
- 如何在不阻塞的情況下檢查按鍵?
- 圖形用戶界面(GUI)常見問題
- 圖形界面常見問題
- Python 是否有平臺無關的圖形界面工具包?
- 有哪些Python的GUI工具是某個平臺專用的?
- 有關Tkinter的問題
- “為什么我的電腦上安裝了 Python ?”
- 什么是Python?
- 為什么我的電腦上安裝了 Python ?
- 我能刪除 Python 嗎?
- 術語對照表
- 文檔說明
- Python 文檔貢獻者
- 解決 Bug
- 文檔錯誤
- 使用 Python 的錯誤追蹤系統
- 開始為 Python 貢獻您的知識
- 版權
- 歷史和許可證
- 軟件歷史
- 訪問Python或以其他方式使用Python的條款和條件
- Python 3.7.3 的 PSF 許可協議
- Python 2.0 的 BeOpen.com 許可協議
- Python 1.6.1 的 CNRI 許可協議
- Python 0.9.0 至 1.2 的 CWI 許可協議
- 集成軟件的許可和認可
- Mersenne Twister
- 套接字
- Asynchronous socket services
- Cookie management
- Execution tracing
- UUencode and UUdecode functions
- XML Remote Procedure Calls
- test_epoll
- Select kqueue
- SipHash24
- strtod and dtoa
- OpenSSL
- expat
- libffi
- zlib
- cfuhash
- libmpdec