Chapter 8. Built-in Tools

This chapter presents a selection of the essential tools that make up the Python standard library—built-in functions, library modules, and their most useful functions and classes. These are the sine qua non; while you most likely won’t use all of these in any one program, no useful program we’ve ever seen avoids all of these. Just as Python provides a list data structure object type because sequence manipulations occur in all programming contexts, the library provides a set of modules that will come in handy over and over again. Before designing and writing any piece of generally useful code, check to see if a similar module already exists. If it’s part of the standard Python library, you can be assured that it’s been heavily tested; even better, others are committed to fixing any remaining bugs—for free.

Note that this chapter gives only a brief look at the best of the standard library. As of current writing, the Python Library Reference is over 200 pages long. More details on the reference are available in Appendix A, but you should know that it’s the ideal companion to this book; it provides the completeness we don’t have the room for, and, being available online, is the most up-to-date description of the standard Python toolset. Also, O’Reilly’s Python Pocket Reference, written by coauthor Mark Lutz, covers the most important modules in the standard library, along with the syntax and built-in functions.

This chapter includes descriptions of two kinds ...

Get Learning Python 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.