Python Distilled

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


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.


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 top 1000 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. After all, 640 pages should be more than enough for anyone--maybe even enough for two people. Thus, a compact book of about 320 pages might be just right.

I've always believed that a book, even a technical book, should try to tell a cohesive story. The challenge is that as Python has grown in popularity, it has really turned into three different languages--each with their own story. There is a whimsical Python for scripting and tinkering, a quirky Python for asynchronous programming and networking, and a serious Python for enterprise applications. Sometimes these stories intersect. Sometimes not. With this in mind, Python Distilled tries to tell the story of Python's central core as well as general principles that will help you write well organized and understandable programs regardless of their flavor. The book is written to use modern idioms as of Python 3.9. However, it doesn't try to cover everything that's possible nor does it present "historical" language features that might have been popular once before, but have faded away over the years.

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 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, perhaps it's better to focus on bigger issues of programming and program organization.

Second, the book completely 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 greatly about the possibility of showing bad examples or giving the reader misleading information. As such, I think it's 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.


Mistakes will be collected and reported here.


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)