Chapter 8. Core Built-ins and Standard Library Modules

The term built-in has more than one meaning in Python. In many contexts, built-in means an object directly accessible to Python code without an import statement. The section “Python built-ins” shows Python’s mechanism 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 file type, and “Internal Types” some other built-in types intrinsic to Python’s internal operation. This chapter provides additional coverage of built-in core types in the opening section and covers built-in functions available in the module builtins in “Built-in Functions”.

Some modules are called “built-in” because they’re in the Python standard library (though it takes an import statement to use them), as opposed to add-on modules, also known as Python extensions.

This chapter covers several built-in core modules: namely, the standard library modules sys, copy, collections, functools, heapq, argparse, and itertools. You’ll find a discussion of each module x in the respective section “The x Module.”

Chapter 9 covers some string-related built-in core modules (string, codecs, and unicodedata) with the same section-name convention. Chapter 10 covers re in “Regular Expressions and the re Module”.

Built-in ...

Get Python in a Nutshell, 4th 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.