[Python-ideas] Asynchronous friendly iterables

Nathaniel Smith njs at pobox.com
Mon Aug 20 03:47:39 EDT 2018


On Mon, Aug 20, 2018 at 12:34 AM, Simon De Greve <degrevesim at gmail.com> wrote:
> Do you mean that for loops inside an "async def" statements are always
> executed as 'async for' loops? That's what I wanted to acheive by writing
> the AsyncDict class (c.f. the CodeReview link).

The only difference between an 'async for' and a regular 'for' is that
the former works on async iterables, and the latter works on regular
iterables. So "executed as 'async for'" doesn't really mean anything,
I think? If you have an async iterable, use 'async for', and if you
have a regular iterable, use 'for'.

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Python-ideas mailing list