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?

Thanks,
Josh
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to