Using Asyncio in Python

Understanding Python’s Asynchronous Programming Features

Book cover|350

Metadata

Author: Caleb Hattingh
Publisher: O’Reilly Media
Year: 2020
Pages: 156
ISBN: 9781492075332
Links: Goodreads

Review

Python’s official documentation on the asyncio module historically didn’t do a great job of distinguishing between end-user goals and goals for library/framework authors. This has made it harder and more confusing for people to get started writing async Python because the functions and methods you have to know about as an end-user are only a small subset of the entire asyncio API.

This book does a good job explaining these concepts for end-users. It includes a number of examples/case studies which demonstrate how traditional threads-based applications could be written with asyncio instead.

When I read this book I was already familiar with async concepts from other languages/runtimes, which made this a breezy read that quickly got me familiar with the main concepts the way they are implemented in Python.

Because of this, to me personally it also felt longer that it needed to be while simultaneously lacking a bit of depth. For example, I would have loved more of a look into handling timeouts as well as Shielding From Cancellation.

I recognize that I’m at the fringes of the book’s intended target audience, but it does make the list price ($44.99) feel rather steep for what you get in terms of content.

There’s a few gems in here about known pitfalls and often-misunderstood methods, but a part of me can’t help but wonder what would have happened if some of the effort that went into this book was instead put into improving Python’s official documentation on the asyncio module itself.