Quote from here:
types.CoroutineType
The type of coroutine objects, created by async def functions.
Quote f
There's a difference between coroutine and coroutine function. The same way as there is a difference between generator and generator function:
Calling the function g
returns a coroutine, e.g.:
>>> isinstance(g(), types.CoroutineType)
True
If you need to tell if g
is a coroutine function (i.e. would return a coroutine) you can check with:
>>> from asyncio import iscoroutinefunction
>>> iscoroutinefunction(g)
True