collections.abc.Awaitable

class collections.abc.Awaitable

ABC for awaitable objects, which can be used in await expressions. Custom implementations must provide the __await__() method.

Coroutine objects and instances of the Coroutine ABC are all instances of this ABC.

Note

In CPython, generator-based coroutines (generators decorated with types.coroutine() or asyncio.coroutine()) are awaitables, even though they do not have an __await__() method. Using isinstance(gencoro, Awaitable) for them will return False. Use inspect.isawaitable() to detect them.

New in version 3.5.

doc_python
2016-10-07 17:28:50
Comments
Leave a Comment

Please login to continue.