[Python-ideas] Fwd: Replacing Infinite while Loops with an Iterator: async edition
jelle.zijlstra at gmail.com
Sun Jun 24 15:34:21 EDT 2018
2018-06-24 12:30 GMT-07:00 <jab at math.brown.edu>:
> On Jun 23, 2018, at 21:11, Nathaniel Smith <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:
>> yield value
> Yes, exactly (thanks, Nathaniel). Wouldn't that be a useful built-in?
> (Greg, I too would be surprised if this were the first time this idea has
> been raised, but I looked before posting and couldn’t immediately
> find prior discussion.)
> There is an open issue for this: https://bugs.python.org/issue31861. It
proposes adding aiter() and anext() as builtins.
> Python-ideas mailing list
> Python-ideas at python.org
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas