Track 12 · Lesson 11 of 12
asyncio basics
Why programs wait, and how async def, await, asyncio.run and the event loop let one thread get on with other work while it waits.
You will be able to
- Explain why I/O-bound programs spend most of their time waiting, and what asynchronous code changes
- Write coroutines with async def and call them with await and asyncio.run
- Describe what the event loop does and why it can only switch tasks at an await
- Recognise blocking calls such as time.sleep inside async code and forgotten awaits
- Compare asyncio with threads and processes, and say which kind of work each suits
Included with a Formula Quest membership
It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.
View Formula Quest memberships
Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.