18.6. Async Iterator
Asynchronous Generators https://peps.python.org/pep-0525/
Asynchronous Comprehensions https://peps.python.org/pep-0530/
__aiter____anext__
18.6.1. Example
>>> class Reader:
... async def readline(self):
... ...
...
... def __aiter__(self):
... return self
...
... async def __anext__(self):
... line = await self.readline()
... if line == b'':
... raise StopAsyncIteration
... return line
18.6.2. Typing
collections.abc.AsyncGenerator