Chapter 7. Core Built-ins and Standard Library Modules

The term built-in has more than one meaning in Python. In most contexts, a built-in means an object directly accessible to Python code without an import statement. “Python built-ins” shows the mechanism that Python uses to allow this direct access. Built-in types in Python include numbers, sequences, dictionaries, sets, functions (all covered in Chapter 3), classes (covered in “Python Classes”), standard exception classes (covered in “Exception Objects”), and modules (covered in “Module Objects”). “The io Module” covers the (built-in, in v2) file type, and “Internal Types” covers some other built-in types intrinsic to Python’s internal operation. This chapter provides additional coverage of core built-in types (in “Built-in Types”) and covers built-in functions available in the module builtins (named __builtins__ in v2) in “Built-in Functions”.

As mentioned in “Python built-ins”, some modules are known as “built-in” because they are an integral part of the Python standard library (even though it takes an import statement to access them), as distinguished from separate, optional add-on modules, also called Python extensions. This chapter covers some core built-in modules: namely, the modules sys in “The sys Module”, copy in “The copy Module”, collections in “The collections Module”, functools in “The functools Module”, heapq in “The heapq Module”, argparse in “The argparse Module”, and itertools in “The itertools Module”. ...

Get Python in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.