On this page
  1. typing.AsyncGenerator
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

typing.AsyncGenerator

Prev: typing.AsyncContextManager | Up: typing | Next: typing.AsyncIterable
Rel: typing.AbstractSet, typing.Annotated, typing.Any, typing.assert_never
Ref: docs.python.org — typing.AsyncGenerator
Tags: #public #python3 #stdlib #typing


Import

import typing
from typing import AsyncGenerator

Signature & Overview

typing.AsyncGenerator(*args, **kwargs)

Deprecated alias to collections.abc.AsyncGenerator.

Usage

from typing import AsyncGenerator

async def counter(n: int) -> AsyncGenerator[int, None]:
    for i in range(n):
        yield i

assert callable(counter)

Gotchas

REPL Inspect

from typing import AsyncGenerator
help(AsyncGenerator)

Linked from

Related notes