On Mon, 20 Aug 2018 at 04:49, Chris Angelico <ros...@gmail.com> wrote: > > On Mon, Aug 20, 2018 at 5:34 PM, Simon De Greve <degreve...@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 point of an 'async for' loop is that grabbing the next value can > block the async function - it's a yield point. If you don't need that, > you can use a regular 'for' loop.
Maybe it is worth to further clarify that iterating on dicts and lists is _not_ blocking at all. That would only be the case if to retrieve its own keys the dictionary would have to perform some I/O access or heavy computation - which, besides been of very little value in practice, would only be possible in a specialized class anyway. > > ChrisA > _______________________________________________ > Python-ideas mailing list > Python-ideas@python.org > https://mail.python.org/mailman/listinfo/python-ideas > Code of Conduct: http://python.org/psf/codeofconduct/ _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/