Python logoPython/
PYL-E1700

`yield from` inside an `async` functionPYL-E1700

Major severityMajor
Bug Risk categoryBug Risk

Use of yield from is not permitted inside an async function. This is a syntax error. It is recommend to rewrite coroutine without using yield from.

Bad practice

async def my_coroutine():
    yield 1
    yield from [2, 3, 4, 5, 6] # Syntax Error
async def my_coroutine():
    yield 1
    for i in [2, 3, 4, 5, 6]:
        yield i