Python aiter() built-in function

From the Python 3 documentation

Return an asynchronous iterator for an asynchronous iterable. Equivalent to calling x.__aiter__(). aiter() is an async equivalent of iter()

Example

>>> async def aitersync(iterable):
...    results = []
...    async for x in aiter(iterable):
...        results.append(x)
...    return iter(results)

Subscribe to pythoncheatsheet.org

Join 10.100+ Python developers in a two times a month and bullshit free publication , full of interesting, relevant links.