New
Python Crash Course, 3rd Edition
A Hands-On, Project-Based Introduction to Programming in Python
by Eric Matthes
Pages
970
Published
2022
Clear, Concise, and Effective Programming with Python's Most Powerful Features
Write Python that reads like expert code — by understanding what the language was designed to do, not just how to make it work.
Fluent Python takes you past syntax and into the mechanics that make Python distinctive. Luciano Ramalho walks through the data model, sequences, functions as objects, object-oriented idioms, and concurrency with precision and depth. At 970 pages, this is a thorough treatment of the language aimed at programmers who already write Python and want to write it the way experienced Pythonistas actually do.
Most Python programmers learn enough to get their code running. Fluent Python is for the ones who want to understand why it runs the way it does, and how to use the language the way its designers intended.
Luciano Ramalho spent years studying the CPython source, the Python data model, and the patterns that distinguish idiomatic Python from code that merely works. This book is the result: a structured, example-driven tour of the language features that separate competent Python from fluent Python.
The book opens with the Python data model — the protocol layer that powers operator overloading, iteration, context managers, and more. From there it moves through sequences and mappings in depth, first-class functions, decorators, closures, object-oriented design with descriptors and metaclasses, and finally concurrency with asyncio, threads, and concurrent.futures. Every chapter builds on the last, and every concept is grounded in runnable examples.
This second edition has been updated for Python 3.10, covering pattern matching introduced in Python 3.10, revised type hinting coverage aligned with modern usage, and updated concurrency chapters that reflect the current state of asyncio.
If you write Python regularly and still feel like you are working around the language rather than with it, Fluent Python is the book that closes that gap. It does not teach you to write more Python. It teaches you to write better Python.
Introduces the special method protocol that underpins all native Python behavior. You implement a simple card deck class to see how dunder methods connect your objects to built-in functions and operators.
Covers lists, tuples, arrays, and their variants at the implementation level. You learn when to use each, how slicing and unpacking work internally, and how to avoid common performance traps.
Examines the hash table implementation behind dicts and sets, explaining why key order is preserved, what makes a valid key, and how to choose between mapping types for different use cases.
Explains the boundary between text and binary data in Python 3, covering encodings, the codec system, and the correct patterns for reading, writing, and converting text in real applications.
Surveys named tuples, dataclasses, and attrs as tools for building data-holding classes. You compare their trade-offs and learn which to reach for depending on mutability, validation, and serialization needs.
Treats functions as objects: callable attributes, higher-order functions, and the functional programming features Python supports. You learn where this style fits naturally and where it does not.
Builds a complete mental model of how closures capture variables and how decorators transform callables. You implement parameterized decorators and understand the stacking order when multiple decorators apply.
Introduces gradual typing, type aliases, and the use of mypy for checking annotated code. You learn how to add hints that document intent without over-constraining the flexibility Python programmers expect.
Covers the dunder methods that control object representation, comparison, hashing, and formatting. You build a Vector class that behaves like a native Python type throughout this chapter and the next.
Distinguishes duck typing, nominal typing, and structural subtyping, and shows when abstract base classes add value versus when they introduce unnecessary ceremony. You implement a protocol for a real use case.
Examines when inheritance is appropriate, how multiple inheritance and the MRO work, and how mixin classes let you compose behavior without committing to a rigid hierarchy.
Shows how to implement arithmetic, comparison, and augmented-assignment operators correctly, including the rules around reflected methods and when not to overload.
Explains the iterator protocol, generator functions, and generator expressions in depth. You replace hand-written iterator classes with generators and see how this pattern scales to lazy pipelines.
Maps out the options for concurrent and parallel Python code, covering threads, processes, the GIL, and asyncio. You develop a framework for choosing the right model for CPU-bound versus I/O-bound work.
Puts concurrent.futures and asyncio to work on practical I/O-bound tasks. You write async client code, manage task groups, and handle cancellation and error propagation correctly.
You need to be comfortable writing Python already. The book assumes you know basic syntax, control flow, and standard library fundamentals. It is not an introduction to programming or to Python.
The second edition covers Python 3.10, including structural pattern matching introduced in that release. Most content applies to Python 3.8 and later, and the few version-specific features are clearly marked.
It works both ways. Ramalho designed the chapters to build on each other, so reading front to back gives the clearest picture. But each chapter is also self-contained enough to use as a reference when a specific topic comes up.
Yes. Every substantive concept is illustrated with runnable code. O'Reilly maintains a companion repository with the book's example files, linked from the book's page on the O'Reilly website.
Yes, though the examples lean toward general-purpose and systems programming. The data model, sequence, and functional programming chapters are directly applicable regardless of your domain.
Fluent Python goes deeper into the language internals and idiomatic patterns than most comparably positioned books. If you want coverage of specific frameworks or libraries, this is not that book — it focuses on the language itself.
New
A Hands-On, Project-Based Introduction to Programming in Python
by Eric Matthes