Skip to main content
Loading page…
Python Mastery
Chapter 36
Lesson 1 of 3
async / await, asyncio & Structured Concurrency
Contents
Notes
Tutor
Concept
The Problem: Waiting is Wasting
Loading activity…
Previous
1 / 9
Continue
Contents
Notes
Discussion
Tutor
28 min
9 activities
0 of 9 done
In this lesson
1
The Problem: Waiting is Wasting
2
Coroutines: async def and await
3
Sequential vs Concurrent Fetch (Simulated)
4
asyncio.gather() Under the Hood
5
Check: When does await actually suspend a coroutine?
6
Pitfall: Blocking the Event Loop
7
Practice: Concurrent URL Checker
8
Coming Up: asyncio.TaskGroup & Structured Concurrency
9
Reflection: When is asyncio NOT the answer?
Objectives
Define and call async functions using async def and await
Run a coroutine with asyncio.run()
Await many tasks concurrently using asyncio.gather()
Identify IO-bound scenarios where asyncio provides a real speed-up
Further reading
asyncio - Asynchronous I/O
Coroutines and Tasks
Chapter 36 · Concurrency & Parallelism
async / await, asyncio & Structured Concurrency
Threading, the GIL & Free-threaded Python
Multiprocessing for CPU Work
Previous: A Complete REST API
Next: Threading, the GIL & Free-threaded Python