[Python-ideas] Asynchronous friendly iterables

Simon De Greve degrevesim at gmail.com
Mon Aug 20 03:34:42 EDT 2018


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).

As I said, I'm pretty new to Asyncio and thus may be missing some
immportant feature of the lib (which is apparently the case here).

Le lun. 20 août 2018 à 09:29, Nathaniel Smith <njs at pobox.com> a écrit :

> On Mon, Aug 20, 2018 at 12:19 AM, Simon De Greve <degrevesim at gmail.com>
> wrote:
> > Hello everyone,
> >
> > I'm quite new working with asyncio and thus maybe missing some things
> about
> > it, but wouldn't it be quite easier to have some iterables to support
> async
> > for loops "natively", since asyncio is now part of the Stdlib?
> >
> > I've tried to work with asyncio while using discord.py, and has some
> > struggle with an "async for" loop on a dictionary, so I had to implement
> a
> > new dict subclass that would just reimplement items(), keys() and
> values()
> > functions.
> >
> > I think that it would be a cool improvement to implement some of those in
> > some standard way. There's some code I wrote on a CodeReview thread but I
> > still haven't got any feedback on it.
> >
> > Here's the link of the thread :
> >
> https://codereview.stackexchange.com/questions/197551/asynchronous-dictionary-in-python
>
> You can do this, but I don't see what it accomplishes...
>
> Are you aware that you can use regular 'for' loops inside 'async def'
> functions?
>
> -n
>
> --
> Nathaniel J. Smith -- https://vorpus.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180820/564bc9db/attachment-0001.html>


More information about the Python-ideas mailing list