How Do Python Coroutines Work?
summary
A minimal async framework is implemented from scratch using nonblocking sockets and Python 3’s selectors, then refactored into coroutines built from generators, Future and Task classes, and the generator yield mechanism; the result replaces nested callbacks with a single generator per request. The demo runs two slow URL fetches two URLs in one second, shows how asyncio’s primitives map to concrete code, and ends with a working toy event loop that actually completes.
AI-written summary · about
chapters (5)
related talks
01h 29mStandardised Coroutine Concurrency in Python 3
01h 00mCoroutine Concurrency in Python 3 with asyncio
01h 23mPython async/await unraveled
29mWhat in the World is Asyncio?
27m"Python’s tale of concurrency"
29mMake a working implementation of async functions in Python 2.1
30m"Asyncio by Example"
25mThe hitchhiker's guide to asyncio
