FDE Times dataFDE jobs open 932▼14 Change in open roles over 7 days, like-for-like: roles from companies we started tracking this week are left outNew in 7 days 62Companies hiring 202Remote-friendly 24%Median US pay $201kTop hirer Databricks 92
中文VI

The newspaper of the Forward Deployed Engineer

Books & courses

Fluent Python's four new chapters cover the code FDEs meet on site

Data classes, type hints and concurrency are what you must read fastest in your first week at a client, though the book is no primer for Python beginners.

Cover of Fluent Python
Fluent Python · Luciano Ramalho · Cover: Open Library
ShareLinkedInFacebookX

In brief

  • The second edition (O'Reilly, 2022) has four new chapters: Data Class Builders, two chapters on type hints, and Concurrency Models in Python.
  • FDEs should read selectively: the data model and data structures, data classes, type hints, and only then concurrency.
  • The async material is worth reading for the thinking, but check it against current Python documentation before applying it.
Chart: in a hypothetical example of 200 API calls at 0.5 seconds each, running them sequentially takes 100 seconds. With a thread pool of 20 workers, the calls split into 10 waves, cutting the time to about 5 seconds. The 5-second figure is highlighted in orange.
I/O-bound work: parallelising the waiting cuts run time from 100 seconds to about 5. Source: hypothetical example in the article, based on chapter 19 of Fluent Python, 2nd edition (Luciano Ramalho, O'Reilly, 2022).

Only four chapters in the table of contents of Fluent Python, Second Edition carry the 🆕 mark: Data Class Builders (chapter 5), Type Hints in Functions (8), More About Type Hints (15) and Concurrency Models in Python (19). Luciano Ramalho, the book’s author (O’Reilly, 2022), also substantially rewrote the chapters on concurrency.

Those changes line up with an FDE’s job. Take the first week at a client: you will very likely spend much of it reading code other people wrote, and that code is likely to have type hints, data classes generated by tools, and pipelines that call APIs in parallel.

If so, the four new chapters may well match the kinds of code you need to read fastest. Two examples below, on type hints and concurrency, show why, along with a reading order and what to do in each part.

Who should open this book, and when?

This is not a beginner’s book: both the ACCU reviewer and the hamatti.org blog say it is meant for people who already have experience writing Python.

If you are just starting out, write real code for a few months before opening it. If you have written Python for a few years but still catch yourself “translating” from Java or C#, skip the cover-to-cover read and follow the order in the diagram at the top of this article.

First idea: an object’s behavior lives in its special methods

The book opens with the Python data model, then moves to lists, dicts and sets. This is the foundation for reading idiomatic Python: double-underscore methods such as __len__ or __getitem__ decide how an object behaves when passed to built-in functions such as len().

Say the client’s code has the line len(batch), where batch is an instance of a custom class. Search for a method called len and you will find nothing; the answer is in __len__. Once this way of looking becomes habit, you read an unfamiliar class by listing its special methods first, then reading the rest.

Chapter 5 is entirely new. Read it straight after the data model material, because many of the data classes you meet may be generated by class-building tools rather than written by hand line by line.

Second idea: type hints are a map, not a shield

The second edition devotes two new chapters, 8 and 15, to type hints. For an FDE, their value is that you can understand a system before running it.

Consider a function in a client SDK with the signature def fetch(ids: list[str]) -> dict[str, Order] | None. That one line tells you what goes in, what comes out, and that you must handle the None case. Without hints, you would be setting breakpoints and guessing.

There is a point Ramalho stresses on Thoughtworks’ technology podcast, though: annotations have no effect at runtime; tools such as mypy are what use them to catch errors in source code. The map is only trustworthy if someone checks it regularly.

Third idea: choose a concurrency model before you write

Chapter 19, on concurrency models, is new and sits in the most heavily rewritten part of the book. It deserves a close read because it gives you the vocabulary to tell threads, processes and async apart before you touch any code.

Consider an integration job that must call 200 client endpoints, each taking about 0.5 seconds, almost all of it waiting on the network. Run sequentially, that takes 200 × 0.5 = 100 seconds while the CPU sits nearly idle. This is an I/O-bound task, so parallelizing the waiting is the right direction.

If the client’s SDK is a synchronous library, a thread pool of 20 workers is the approach that changes the least code: 200 calls split into 10 rounds, down to about 5 seconds. If the whole chain already has an async client, asyncio with a limit of 20 concurrent requests gives a similar result. If the slow part is CPU-heavy parsing, neither approach will save you.

Three traps when taking the book into a real project

The first trap is copying the book’s asyncio patterns wholesale into client code. The ACCU reviewer considers the asynchronous programming chapters outdated, so take the thinking from chapter 19 and check the specific APIs against current Python documentation before using them.

The second trap is trusting hints in a repo that has never run mypy. Because annotations do nothing at runtime, the hints may have drifted from reality long ago without anyone noticing.

On day one, ask the client’s team whether CI runs a type checker. If it does not, run mypy on your own machine and treat the error count as a measure of how far the map can be trusted.

The third trap is parallelizing before measuring. Before writing the first line of parallel code, measure how long a single call takes and set a request limit, so your job does not overload the client’s own API.

Turn your reading into evidence on your CV

The official example code lives in the fluentpython/example-code-2e repo on GitHub, and fluentpython.com is the companion site for the second edition, with additional articles in its extra section.

The most effective way to read is to refactor as you go. Pick an old Python project of your own, convert the hand-written data classes to data classes, add type hints and have mypy run in CI. On a CV, one line stating exactly what you did, with a link to the commit, is far more convincing than the words “proficient in Python.”

Memorizing syntax is not the goal. The goal is to open an unfamiliar repo and understand it quickly enough that the client’s team trusts you, and these chapters are the shortest route to practicing that skill.

Was this article useful?

Use with your AI assistantAsk Claude ↗Ask ChatGPT ↗
7 sources
Read next on the roadmap · Stage 1: FoundationsThe Phoenix Project explains why your customer's ops team is so slowThe 2013 DevOps novel opens with a missed payroll and shows how one brilliant but overloaded engineer can block an entire system.