[Python-ideas] Replacing Infinite while Loops with an Iterator: async edition

jab at math.brown.edu jab at math.brown.edu
Sat Jun 23 17:41:15 EDT 2018

I first learned the ``for chunk in iter(lambda: sock.recv(N), b'')`` trick
from page 138 of Dave Beazley’s fantastic Python Cookbook (“4.16. Replacing
Infinite while Loops with an Iterator”), and never looked back.

When I started to play with consuming sockets asynchronously, it occurred
to me that it would be nice if we could write an async version of this, as
in ``async for chunk in aiter(...)``.

Is anyone working on adding that to Python, or at least interested too?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180623/26370b93/attachment.html>

More information about the Python-ideas mailing list