Skip to content

MaybeAwaitable

Canonical path: o6.MaybeAwaitable

MaybeAwaitable module-attribute

MaybeAwaitable = _T | Awaitable[_T]

Either a plain value or an awaitable of it.

The return type of every operation that adapts to its caller: a Client or Server driving its own event loop returns the value directly, while one attached to a running asyncio loop returns an awaitable. The same source code works in both modes, with await where the loop is external.

See One API, synchronous or asynchronous.