Python Distilled

Python Distilled [Amazon]
Addison-Wesley Professional (2021)
ISBN 0134173279;

About

This is a book based on my 25 years of coding, writing about, and teaching Python. It's also a book that reflects topics that I think are central to problem solving and thinking in the Python language. Somewhat controversially, this does NOT include the entirety of the Python language or standard library (hence the "distilled" moniker). But, see more about that below.

Backstory

When I first started using Python in the 1990s, it was a small language built around a number of core concepts. If you spent the time to master those concepts, you could go far. In fact, a slogan for one of the early Python conferences was "it fits your brain." I still have the T-shirt.

In 1999, I published the "Python Essential Reference"--perhaps the first reference book to be written about Python. My inspiration was the well-regarded Kernigan and Ritchie "C Programming Language" book that was small, but which contained almost everything you needed to know to be productive. Over the next decade, I updated the Essential Reference three times, with the last edition weighing in at a more hefty 640 pages. That was ten years ago. A lot has changed in the Python world since then. Would a new edition double to 1280 pages? Would it even be feasible to fit in anyone's brain? Perhaps not. Perhaps it would be better to aim for a much smaller book--maybe something around 320 pages would be just right. But, how do you do that?

Notable Ommissions

To make a compact book, a number of key topics aren't addressed. Let's discuss!

First, the book makes no effort whatsoever to provide reference material for Python's standard library. For one, the official documentation at docs.python.org already has all of this information. Moreover, IDEs additionally provide a lot of reference help in the form of tool-tips and autocompletion. Thus, rather than trying to replicate all of that in a book, I choose to focus on bigger issues related to programming and program structure.

Second, the book mostly ignores the emerging world of statically typed Python. Type hints are mentioned, but rarely appear. This is not to downplay the usefulness of typed Python in large projects. However, thinking in types is far more nuanced than simply sticking type hints on everything. Since I don't generally work on large projects where type hints shine, I worry about the possibility of showing bad examples or giving the reader misleading information. As such, it's probably better to say nothing than to lead people astray. Besides, other books such as the recently published Robust Python (O'Reilly Media) do a good job of tackling this topic.

Finally, I say very little about the inner workings of asynchronous Python as is found with code associated with the asyncio module. This might seem rather surprising given the large number of talks I have given on this subject as well as my own work on an async library. However, a recurring theme in many of my talks is "how much low-level information does a user need to know to be productive?" For example, if you open a file in Python, do you need to know how system calls in the operating system work? Probably not. Similarly, if you're using a high-level library or framework that happens to use async, do you need to know how its internal event loop works? Not really. Thus, coverage of async-related topics tend to stay "high-level" as opposed to digging into the internals.

Errata

Errata can be found on GitHub.

Thanks

Last, but not least, I'd like to thank all of the students who've attended my courses over the years. I always learn a lot by teaching. Many of these lessons are reflected in the book.

-- Dave Beazley (July, 2021)


Copyright (C) 2005-2024, David Beazley