inspect.isawaitable()

inspect.isawaitable(object)

Return true if the object can be used in await expression.

Can also be used to distinguish generator-based coroutines from regular generators:

def gen():
    yield
@types.coroutine
def gen_coro():
    yield

assert not isawaitable(gen())
assert isawaitable(gen_coro())

New in version 3.5.

doc_python
2016-10-07 17:35:03
Comments
Leave a Comment

Please login to continue.