In the docs related to async for syntax in Python 3.5, I realized that it was introduced to iterate over the expected iterator.
There is something in the semantic equivalent that I don't get, following the description:
iter = (ITER) iter = type(iter).__aiter__(iter) running = True while running: try: TARGET = await type(iter).__anext__(iter) except StopAsyncIteration: running = False else: BLOCK else: BLOCK2
What does the string iter = type(iter).__aiter__(iter) do? Why is this necessary?
source share