Errata

Fluent Python

Errata for Fluent Python, Second Edition

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Page 785
First full paragraph on under "New Concept: Awaitable:

In the paragraph starting with, "However, end-user code does not always need to await a Task," there is the claim that "If you don't expect to cancel the task or wait for it, there is no need to keep the `Task` object returned from `create_task`. Creating the task is enough to schedule the coroutine to run."

This is an error that can cause very difficult-to-impossible to debug heisenbugs. In the documentation for `asyncio.create_task`, (URL removed to allow submission; bit silly if you ask me), there is now the following warning:

Important: Save a reference to the result of this function, to avoid a task disappearing mid-execution. The event loop only keeps weak references to tasks. A task that isn’t referenced elsewhere may get garbage collected at any time, even before it’s done. For reliable “fire-and-forget” background tasks, gather them in a collection

followed by an example of the issue and how to prevent it.

I believe this issue wasn't fully realized and mentioned in the documentation until after the text was published.

Samuel Woodward  Feb 26, 2023