Concurrencyasync/await Fundamentals
All courses

Concurrent I/O without thread spaghetti

async def defines coroutines. await yields control while waiting on I/O. asyncio.gather runs many coroutines concurrently.

Quirk — the GIL: Threads don't parallelize CPU-bound Python well because of the Global Interpreter Lock. Use multiprocessing for CPU parallelism, asyncio for I/O.

Output
Press Run to execute your code.