[Python-ideas] Fwd: Replacing Infinite while Loops with an Iterator: async edition
jab at math.brown.edu
jab at math.brown.edu
Fri Aug 24 01:03:26 EDT 2018
On Sunday, June 24, 2018 at 7:48:34 PM UTC-4, Greg Ewing wrote:
>
> j... at math.brown.edu <javascript:> wrote:
> > On Jun 23, 2018, at 21:11, Nathaniel Smith <n... at pobox.com
> > <mailto:n... at pobox.com>> wrote:
> >
> > He's asking for an async version of the 'iter' builtin, presumably
> > something like:
> > async def aiter(async_callable, sentinel):
> > while True:
> > value = await async_callable()
> > if value == sentinel:
> > break
> > yield value
> > -n
> >
> > Yes, exactly (thanks, Nathaniel). Wouldn't that be a useful built-in?
>
> Ah, sorry, I misunderstood.
>
> I'm surprised this doesn't exist already -- it seems like an
> obvious thing to have along with the other async features.
>
> --
> Greg
>
Just submitted a PR: https://github.com/python/cpython/pull/8895
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180823/4218cad5/attachment.html>
More information about the Python-ideas
mailing list