python - What is the difference between @types.coroutine and @asyncio.coroutine decorators? -


documentations say:

@asyncio.coroutine

decorator mark generator-based coroutines. enables generator use yield call async def coroutines, , enables generator called async def coroutines, instance using await expression.

_

@types.coroutine(gen_func)

this function transforms generator function coroutine function returns generator-based coroutine. generator-based coroutine still generator iterator, considered coroutine object , awaitable. however, may not implement __await__() method.

so seems purposes same - flag generator coroutine (what async defin python3.5 , higher features).

when need use asyncio.coroutine when need use types.coroutine, diffrence?


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -