Verdict: Recommended
This book was first published in 2015 when Python 3.4. was the latest version. This review is about the second edition, released in 2022 with Python 3.10. The new edition contains new and updated chapters about concurrency, type hints, pattern matching and coroutines. Those are the parts of the language that have changed the most between 3.4 and 3.10. The chapters about asynchronous programming have become outdated since then. Even though I already own the first edition, I found it necessary to upgrade.
Fluent Python is not an introduction to the Python programming language. Even the first chapter touches on advanced topics such as class design and operators. Also, the book does not cover the wider Python ecosystem (packaging, deployment, pip, build tools, etc.). It focuses on the core language with the standard library, and it teaches a programming style that matches the fundamental principles of the language.
I found the emphasis on idiomatic Python, known as ‘pythonic’ very useful, especially as a C++ programmer who adopted Python as a second or a companion language. This process of rethinking or even unlearning existing coding habits reminded me of the adoption of modern C++. The book shows how Python supports programming idioms, like Generators, pattern matching, coroutines, list-, set- and dictionary comprehensions. They are not only shown by example but also explained in the context of the wider programming languages landscape, sometimes presented with the rationales of the language designers. It teaches an elegant programming style that goes with the flow, as the title says.
The author has worked for more than 20 years with Python and is very passionate about it. His background in training and consulting is an advantage for the reader as the material is well-structured and engaging.
The sheer volume of this material is impressive. The book has almost 1000 pages and there is even more on the companion website https://www.fluentpython.com/. The complete sample code can be found on the fluentpython GitHub site. The size of this book may be a result of covering several levels of abstraction. Topics range from fundamental language features and data structures to high-level concepts such as design patterns, functional programming and metaprogramming. I found the treatment of some GoF design patterns in chapter 10 very interesting. We have seen debates about their usefulness and their relationship with language features many times since the 1990s. The author shows how functions as objects can simplify the implementation of some classic GoF patterns. He shows that they can become almost invisible while the underlying ideas remain the same.
I didn’t read this book from cover to cover like a novel. Instead, I tried the concepts that I wanted to understand with examples until I was able to use them in real code. Some of them, like metaprogramming and asyncio, I have only experimented with so far.
Conclusion
I recommend Fluent Python for self-study to anyone who wants to use Python. It is ideal for those who have already written some Python programs. It is also a good starting point for programmers with experience in other languages. The author has an excellent aptitude for didactics.
It is very unlikely that anyone needs all the material at this depth at once. The amount may be intimidating but it becomes manageable when one thinks of its five parts as separate smaller books: 1. Python data structures, 2. Functions, 3. OOP, 4. Control flow (with the coroutines chapter on the companion website) and 5. Metaprogramming.
Website: https://www.oreilly.com/library/view/fluent-python-2nd/9781492056348/