[issue28777] Add asyncio.Queue __aiter__, __anext__ methods

Guido van Rossum report at bugs.python.org
Tue Jul 25 23:34:51 EDT 2017


Guido van Rossum added the comment:

> > there's no way to end the loop on the producing side.

> I might be missing something, but can't something similar be said of queue.get()?

That's my point, actually. If you are wrapping the Queue protocol with __aiter__/__anext__ the caller would expect there's a way to signal to the latter that the loop is over (so it can raise StopAsyncIteration). But since .get() doesn't have a way to signal this, an async for-loop would not be able to terminate (other than through break).

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28777>
_______________________________________


More information about the Python-bugs-list mailing list