ID EN
Typing

Coroutine

Python 3.11

Deprecated alias to collections.abc.Coroutine.

Syntax

PYTHON
class typing.Coroutine(Awaitable[ReturnType], Generic[YieldType, SendType, ReturnType])

Examples

Example 1
PYTHON
from collections.abc import Coroutine
c: Coroutine[list[str], str, int]   Some coroutine defined elsewhere
x = c.send('hi')                    Inferred type of 'x' is list[str]
async def bar() -> None:
    y = await c                     Inferred type of 'y' is int

See Also

collections.abc.Coroutine Generator collections.abc.Coroutine Generic Alias Type