Run concurrent work in Python with asyncio: coroutines, tasks, queues, timeouts, and cancellation.
Seven courses in, every program you have written has done one thing at a time, and most of them have spent their lives waiting. Waiting for a file to open, for a query to come back, for something on the other side of a network to answer. While your program waits, it does nothing else, so a program that could have handled four jobs handles one and stares at a wall for the other three. This course hands the waiting back. You write coroutines with async def and run them with asyncio.run, then start several waits at once with tasks, gather, and TaskGroup. After that comes the machinery that makes concurrent code survive contact with a real workload: streams of values consumed as they arrive, a queue with a pool of workers pulling from it, timeouts on work that must not run forever, cancellation that cleans up after itself, and error handling for the case where one of five things fails and you still need to know which one. Everything is built on the Dispatch Desk, a courier depot. It starts as a desk that handles one job at a time and ends as a pipeline: jobs arriving as a stream, couriers pulling from a shared queue, jobs withdrawn when they take too long, and a desk that survives a courier failing and still reports what happened. The last section is honest about the two things a browser cannot give you, threads and processes, what each one is actually for, and how you would choose between all three on a real machine.
45 Lessons • 53 Practices • 18 Quizzes • 4 Projects · ~10h Total
Not just theory. You finish this course with real work to show.
This is the same in-browser editor every lesson uses. Edit the code, hit Run.
Run code in the browser and see the result immediately. Every lesson works this way.
Stuck? Puff explains the error and nudges you forward, without giving the answer away.
Streaks, diamonds, and certificates. Your progress saves automatically, forever.
Every completed course issues a certificate with a public verification link.
Every certificate has a public verification link employers can check.
One certificate per course. Finish a program and earn its program certificate too.
LinkedIn-ready, with a PDF you can download and attach.
Your code spends its time on files, queries, and requests. This is how it stops doing them one at a time.
You have written async somewhere else and want the Python spelling, including the parts that genuinely differ.
Every handler in FastAPI and every modern client library is a coroutine. This is the reading knowledge that unlocks them.
Async Python is free to start, no credit card needed. Some later sections are part of Pro, and finishing every section, including the certificate, needs a Pro plan.
Yes, through Python Testing. Generators and context managers do the most work here and are assumed rather than re-taught: an async generator is a generator with async in front of it, and async with is the context manager you already know with two extra underscores in the method names. Git Basics and SQL Basics sit in the Python Developer program near this course and are not needed for anything in it.
No, and the difference is the single most useful thing in this course. Threads let several pieces of code make progress by being interrupted and swapped by the operating system, at any moment, whether you expected it or not. Async code runs on one thread and only ever swaps at a point you wrote yourself, the word await. That makes async code far easier to reason about, and it also means async gives you nothing at all when the work is computing rather than waiting.
Only if your code waits. Four jobs that each spend ten milliseconds waiting for a reply finish in about ten milliseconds concurrently instead of forty, because the waiting overlaps. Four jobs that each spend ten milliseconds calculating still take forty, because there is still only one worker doing the calculating. Section 1 is built around exactly this distinction and section 8 explains what you would reach for instead.
Because Python here runs as CPython compiled to WebAssembly inside a browser tab, and that build has no threads to start: threading.Thread().start() answers with a RuntimeError saying it cannot start a new thread. Section 8 is built on that honestly. You catch the real error, read the real message, and learn what threads and processes are for and when you would reach for each, rather than being shown a simulation of them.
The Dispatch Desk, a courier depot, across four projects. It grows from a desk that handles one job at a time into a concurrent pipeline: jobs dispatched all at once, a queue feeding a pool of couriers, work withdrawn when it takes too long, failures reported without stopping everything else, and a shutdown that leaves no task running.
Yes, for this course at 100 percent. It also counts towards the Python Developer program certificate, which issues once every course in that program is complete.
How this course connects to the bigger picture, and what to explore next.
Query real data with SQL: SELECT, filtering, sorting, joins, grouping, and the tables behind every app.
Test Python properly with pytest, unittest, doctest, and type hints, and the tooling jobs expect.
Write real Python in your browser: variables, strings, conditionals, loops, lists, and functions.
Free to start, no credit card required. Write real code from the first lesson and keep your progress forever.
Start Learning Free