awaitExpert Playground

Pauses execution of an async coroutine until a result is available

Python Playground
Output
Click "Run" to execute your code

await compiles to GET_AWAITABLE (which calls __await__) followed by SEND. The event loop drives coroutines by repeatedly calling send(None) until StopIteration, which carries the return value.

Challenge

Try modifying the code above to explore different behaviors. Can you extend the example to handle a new use case?