In applied usage for the Asynchronous IO coroutine, yield from
has a similar behavior as await
in a coroutine function. Both of which is used to suspend the execution of coroutine.
yield from
is used by the generator-based coroutine.
For Asyncio, if there's no need to support an older Python version (i.e. >3.5), async def
/await
is the recommended syntax to define a coroutine. Thus yield from
is no longer needed in a coroutine.
But in general outside of asyncio, yield from <sub-generator>
has still some other usage in iterating the sub-generator as mentioned in the earlier answer.