I'm trying to wrap my head around async/await in python.
Am I on the right track?
async
and@coroutine
functions returns coroutine/generator, not the returned value.await
extracts the actual return value of coroutine/generator.
async
function result (coroutines) is meant to be added to event-loop.await
creates "bridge" between event-loop and awaited coroutine (enabling the next point).@coroutine
'syield
communicates directly with event-loop. (skipping direct caller which awaits the result)
await
can be used only inside async functions.yield
can be used only inside@coroutine
.
(@coroutine
= @types.coroutine
)