SOARDO
Software Engineer (SDE)pythonadvanced3 interactive MCQs in app

asyncio.gather, Tasks & Concurrency Patterns

sequential await vs concurrent asyncio.gatherreturn_exceptions & TaskGroup failure behaviorbounding concurrency with asyncio.Semaphore

`await task1(); await task2()` sequentially waits for `task1` before starting `task2`! Wrap independent coroutines in `asyncio.gather(task1(), task2())` (or `asyncio.TaskGroup()` in 3.11+) so both start simultaneously (`total = max(t1, t2)`, NOT `t1 + t2`). Pass `return_exceptions=True` to `gather` when one failure must not discard sibling results, and pair external calls with `asyncio.wait_for(..., timeout=...)`.

two 300ms HTTP calls run via `await a(); await b()` take `600ms`, whereas `await asyncio.gather(a(), b())` finishes in `~300ms`!
assuming sequential `await a(); await b()` executes concurrently, or leaving unbounded `asyncio.gather(*10k_urls)` with no semaphore.
Python Concurrency — Real Pythonread ↗asyncio.gather, Tasks & Concurrency Patterns — Applied Practicepractice ↗Exercism Python Track (Interactive)practice ↗

Practice asyncio.gather, Tasks & Concurrency Patterns with 3 graded MCQs & written feedback.

Take SOARDO’s free 12-question diagnostic to see how strong you are across your target role and unlock adaptive daily missions.

Test yourself free on SOARDO →View full Software Engineer roadmap

More Software Engineer Study Guides