Interactive course · 21 lessons · ~7 hours

Advanced Python: stop guessing what it does.

You can already write Python. This course is about why it behaves the way it does — why a default argument remembers old values, why two variables change together, what @decorator actually is, how @property works, and what the GIL really prevents. Every example is runnable and every output shown is real.

0 of 21 lessons complete0%

The one idea this course is built on

In Python, variables are not boxes that hold values — they are names attached to objects. Almost every surprising behaviour in the language is this one fact in disguise.

The wrong model — "variables are boxes" box a [1, 2, 3] box b (a copy?) [1, 2, 3] Predicts: b.append(4) leaves a alone. Wrong. The real model — "names are labels" a b list object id=0x7f3a… [1, 2, 3, 4] b = a attaches a second label. ONE object, two names. Things this single idea explains · Why def f(x=[]) keeps growing — the default object is created ONCE and reused (lesson 04) · Why [[0]*3]*3 gives a grid where editing one row edits all three (lesson 01) · Why functions can "modify" a list you pass in, but not an int (lesson 01) · Why is and == differ, and why small ints and some strings seem to be "is"-equal (lesson 03) · Why closures in a loop all see the LAST value (lesson 02) · and how CPython knows when to free memory (lesson 03) Lesson 01 builds this model properly; everything else stands on it.
Assignment never copies. It binds a name to an existing object. Copies only happen when you ask for one — list(a), a.copy(), copy.deepcopy(a).
Who this is for

You know loops, functions, lists, dicts and basic classes. If for, def and class are new to you, do the official Python tutorial first (docs.python.org/3/tutorial) — then come back. Examples target Python 3.12+, and call out anything newer.

Pick a path

~2 hours

I keep hitting weird bugs

Lessons 01, 02, 04. Names vs objects, scope and closures, and function defaults explain most of them.

~3 hours

Python interview coming up

Lessons 01, 03, 05, 06, 09, 16, 17. Object model, decorators, generators, dunders, the GIL and asyncio.

~2 hours

I write libraries / frameworks

Lessons 09, 10, 11, 12, 15. The data model, descriptors, dataclasses, metaclasses and typing.

~2 hours

My code is too slow

Lessons 03, 16, 17, 18. Know what the interpreter does, pick the right concurrency model, and profile first.

Ships with a hands-on project

🛠 Build a small task-queue library

A registry of jobs declared with a decorator, retry and timeout policies, typed configuration validated by descriptors, a lazy generator pipeline for results, an asyncio worker pool — packaged with pyproject.toml and covered by pytest. Every lesson in the course shows up in one real codebase.

Open the project →

The curriculum