Chapter 8. Core Built-ins

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 (covered in Chapter 4), classes (covered in Python Classes), standard exception classes (covered in Exception Objects), and modules (covered in Module Objects). The built-in file object is covered in File Objects, and Internal Types covers some built-in types intrinsic to Python’s internal operation. This chapter provides additional coverage of the core built-in types (in Built-in Types) and covers built-in functions available in module _ _builtin_ _ (in Built-in Functions).

As I 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 documents some core built-in modules, essentially those that offer functionality that, in some other languages, is built into the languages themselves: namely, modules sys in The sys Module, copy in The copy Module, collections in The collections Module, functional (2.5 only) in The functional Module, bisect in The bisect Module, heapq in The heapq Module, UserDict in ...

Get Python in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.