AI engineering glossary · Python advanced
What is async and await?
async and await: Keywords for asynchronous code. async def defines a coroutine function; await pauses it until another awaitable finishes, letting the event loop run other tasks meanwhile. Both keywords work only inside async def functions, apart from special cases.
async and await: an example
async def get(): r = await client.get(url) pauses at the request while other coroutines proceed.
Related terms
- Coroutine
- asyncio
- Event loop
- Awaitable
More Python advanced terms
Where you learn it
async and await is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.