Collection Interface ABCs

collections.abc.AsyncGenerator

Asynchronous iterators additionally offering asend, athrow and aclose.

Formal Syntax & Structure

python syntaxpython
collections.abc.AsyncGenerator

Return Value

type

Abstract base class object representing the described interface; use it for recognition or inheritance.

Working Example

Example Snippetpython
import collections.abcasync def f(): yield 1g=f()import asynciotry: result=isinstance(g,collections.abc.AsyncGenerator)finally: asyncio.run(g.aclose())print(result)
Python Reference