2 ms·
Python's plans for async was originally to use generators (that's the original reason for `yield from` IIRC: an async function may need to yield / await multipl
by masklinn 3y ago
Python's plans for async was originally to use generators (that's the original reason for `yield from` IIRC: an async function may need to yield / await multiple times before it "completes" and returns a value).
Ultimately async was introduced because:
- mixing async-generators and sync-generators was extremely confusing and difficult to wrap your way around especially if you needed to nest them (e.g. a generator yielding awaitables)
- lots of statements may need async for which generators are inconvenient and require manual desugaring and ad-hoc protocols with pure generators most notably asynchronous iterables