Foundations
This part is the running start. It assumes nothing — not Python, not programming, not even that you’ve read about Python before. By the time you finish it, you will be able to read and write idiomatic Python code: variables, control flow, functions, classes, files, modules, the standard library, and the practices that make a script a real program.
The arc walks the ladder from concept to capability:
1 How Python Thinks introduces the three mental models — every value is an object, variables are labels not boxes, Python uses protocols not types — that the rest of the book rests on.
2 Values and Variables, 3 Strings and Text, 4 Control Flow give you the primitives: numbers, strings, branches, and loops.
5 Collections covers the four built-in containers — list, tuple, dict, set — and the comprehensions that build them.
6 Functions introduces functions as objects, scope, closures, and a first taste of decorators and generators.
7 Errors and Exceptions handles what happens when things go wrong; 8 Files and I/O handles talking to the file system.
9 Classes lets you define your own types with
__init__,@property, inheritance, andsuper().10 Modules and Packages and 11 Standard Library Tour zoom out from single files to projects and the standard library.
12 Writing Real Programs collects the idioms — type hints, tests, logging,
argparse, and the fifteen patterns that separate beginner Python from idiomatic Python.
Each chapter ends with a Going deeper pointer to the chapter in Parts I–V where the topic is taken apart in detail. You can read this Foundations part end-to-end, then continue into the deep dives — or you can skip ahead and treat Foundations as reference. The book is structured to support either path.
By the end, you will be a capable Python programmer. After that, the rest of the book is about why Python feels the way it does — the data model, the protocols, the descriptors, the metaclasses — and how to use those mechanisms to write code that participates in the language instead of fighting it.