9 short, example-driven guides to one Python idea at a time.
Install to your first real script
Install Python and get to a real, working script: values and types, variables, decisions, loops, lists and dictionaries, functions, modules, files, and reading an error when something breaks. One short path, standard library only, every example run when the book was built.
Lists, tuples, sets, and dicts, and when to use each
The four containers every Python program is built from, covered properly: lists, tuples, sets, and dicts, comprehensions, and the collections module tools built on top of them. By the end you know which structure actually fits a job, not just which one happens to work.
Classes, dunder methods, and dataclasses
A focused, example-driven guide to classes in Python: __init__ and self, the dunder methods that make a class behave like a built-in type, class methods, inheritance versus composition, properties, and dataclasses. Standard library only, and every example was run when the book was built. By the end you can read a class-based codebase and design your own small class hierarchy without guessing.
The modules worth knowing before you reach for pip
The standard library modules that come up once you're past the basics: itertools, functools, datetime in depth, contextlib, argparse, subprocess, and logging. By the end you can build a small real command-line tool using nothing but what Python already ships with.
Reading, writing, and organizing files
A short, example-driven guide to working with files in Python: opening them safely, handling text and encodings, using pathlib for paths, and reading and writing CSV and JSON. Nothing here needs a package you have to install, and every example was run when the book was built. By the end you can get data in and out of a file without looking it up.
How they work, and how to write your own
Closures, `*args`/`**kwargs`, a decorator written from scratch, functools.wraps, decorators that take arguments, class-based decorators, and the functools toolkit (lru_cache, cached_property, singledispatch). By the end you can write your own decorators with confidence and read decorator-heavy code without losing the thread.
Lazy evaluation and pipelines that don't choke on memory
The iterator protocol, generator functions and their quirks, generator expressions, yield from, and a practical tour of itertools (chain, islice, groupby, takewhile, accumulate, and more). By the end you can write your own iterators and generators, chain them into a lazy pipeline that processes a file too large to hold in memory, and read itertools recipes without guessing what they do.
Catch bugs before you run the code
Annotating functions and variables, Optional and union types, typed collections, type aliases, typing a class, Callable, reading a mypy error, TypedDict, Protocol, and a first look at generics. By the end you can annotate a real module, run mypy against it, and know when a hint is worth adding and when it is not.
From your first assert to a suite that stays green
Plain assert and pytest's failure output, organizing tests, fixtures and conftest.py, parametrize, marks and test selection, testing files and errors, monkeypatch and unittest.mock, coverage, and a short TDD loop. By the end you can add a real test suite to an untested project and keep it green as the code changes.