ID EN
Inspect

isawaitable

Python 3.11

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

Syntax

PYTHON
inspect.isawaitable(object)

Examples

Example 1
PYTHON
import types

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

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

See Also

await