</>CodexBash
All articles
Python and JavaScript

asyncio explained

Python's asyncio from the ground up: coroutines, async and await, the event loop, running tasks concurrently with gather and TaskGroup, timeouts, limiting concurrency with semaphores, async HTTP, and the blocking-call mistake that freezes everything.

CodexBash, , 4 min read

A program that calls a hundred web APIs one after another spends nearly all its time waiting for responses. asyncio, Python's built-in library for asynchronous programming, lets one thread start all hundred requests and handle each response as it arrives, finishing in roughly the time of the slowest single request. It powers frameworks like FastAPI and libraries like httpx and aiohttp. This article explains coroutines, the event loop and the patterns you need, plus the mistake that silently ruins async code.

Sign in to read the rest

The whole 4 minute article is free with an account, along with every problem, lesson and tutorial. No card.