Caffeinated Coder
Book an appointment
Lesson 27 · How programs really run

Async code and the event loop

Most of a download is waiting: for the network, for the disk. Async code puts that waiting to use. Watch Python's event loop run three downloads on one thread, one task at a time, parking each task while it waits and resuming it when its data is ready, so all three finish in about the time of the slowest.

11 min10 steps5 questionsIntermediate
Fig 27 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.