Skip to Content
Python 技術手冊 第三版
book

Python 技術手冊 第三版

by lex Martelli, Anna Martelli Ravenscroft, Steve Holden
January 2018
Intermediate to advanced content levelIntermediate to advanced
856 pages
17h 17m
Chinese
GoTop Information, Inc.
Content preview from Python 技術手冊 第三版
229
7
核心內建功能和
標準程式庫模組
built-in
這個詞,在 Python 中的意義不只一個。在多數情境中,一個
built-
in
代表無須
import
述句就能在 Python 程式碼中直接取用的一個物件。前
面「Python 的內建物件」中展示了 Python 用來允許這種直接存取的機制。
Python 中的內建型別(built-in types)包括了數字、序列、字典、集合、
函式(全都涵蓋於第 3 章)、類別(涵蓋於前面的「Python 類別」)、標準
例外類別(涵蓋於前面的「例外物件」),以及模組(涵蓋於前面的「模組
物件」)。後面的「io 模組」涵蓋(v2 中內建的)
file
型別,而「內部型
別」則涵蓋了 Python 內部運作所需的其他一些內建型別。本章額外涵蓋了
核心的內建型別(後面的「內建型別」)並涵蓋模組
builtins
v2 中名為
__builtins__
)中可用的內建函式,在後面的「內建函式」中。
如前面「Python 的內建物件」中所提到的,某些模組之所以被稱為「built-
in」,是因為它們是 Python 標準程式庫不可或缺的部分(雖然需要
import
述句才能取用它們),以區別其他分開的、選擇性的附加模組,也
叫做 Python
擴充功能
extensions
。本章涵蓋一些
核心的
core
內建
模組:也就是後面「sys 模組」中的模組
sys
、「 copy 模組」中的
copy
collections 模組」中的
collections
、「 functools 模組」中的 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

測試驅動開發|使用 Python

測試驅動開發|使用 Python

Harry J.W. Percival
Linux 内核观测技术BPF

Linux 内核观测技术BPF

David Calavera, Lorenzo Fontana

Publisher Resources

ISBN: 9789864766819