Async Python, by Running the Loop

The event loop, coroutines and tasks, and the patterns real async code is built from - each one runnable in your browser.

5 modules Free, no login Updated 11 September 2026

About this track

Async Python confuses people because it looks like threading and is not: it is one thread running an event loop that lets coroutines step aside at every await, so a thousand waits can overlap without a thread each. This track builds that model from the loop up.

Every page runs. The examples end in await main() because the editor already has a loop going, and each one prints the thing being explained - the interleaving of two coroutines, the difference between sequential awaits and concurrent tasks, a blocking call freezing the loop, a bounded queue applying backpressure.

All 5 modules, in teaching order

  1. 01The Event Loop, Stepped Through
  2. 02Coroutines, Tasks and await
  3. 03Running Work Concurrently: gather and TaskGroup
  4. 04The Blocking Call That Freezes the Loop
  5. 05Queues, Producers and Backpressure

Other tracks