You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
567 B
567 B
Real Python AsyncIO Walkthrough
https://realpython.com/async-io-python/
Rules of Async Coroutines
async def f(x):
y = await z(x) # OK - `await` and `return` allowed in coroutines
return y
async def g(x):
yield x # OK - this is an async generator
async def m(x):
yield from gen(x) # No - SyntaxError
def m(x):
y = await z(x) # Still no - SyntaxError (no `async def` here)
return y
An awaitable object is either (1) another coroutine or (2) an object defining an .await() dunder method that returns an iterator.