[issue31861] aiter() and anext() built-in functions
Davide Rizzo
report at bugs.python.org
Fri Oct 27 05:52:53 EDT 2017
Davide Rizzo <sorcio at gmail.com> added the comment:
I attempted to make a Python implementation (attached) to use in my code. There are a few questions in the comments.
One of the complications is the async equivalent of next with two arguments like next(iterator, default). It cannot return the result of __anext__() because it needs to catch StopAsyncIteration. So it should return an awaitable wrapper instead (in my Python code this is rendered as a coroutine). A secondary question is whether the default value should be returned as it is passed, or awaited on.
----------
Added file: https://bugs.python.org/file47242/aiter_comp.py
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31861>
_______________________________________
More information about the Python-bugs-list
mailing list