async enumeration - possible?

Marko Rauhamaa marko at pacujo.net
Wed Nov 30 02:53:11 EST 2016


Chris Angelico <rosuav at gmail.com>:

> On Wed, Nov 30, 2016 at 7:07 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Any of these that depend on pumping the entire iterable can simply
> synchronify [1] the iterable:

One of the more useful ones might be:

    o = await anext(ait)

> list(x async for x in aiterable)
>
> Interestingly, I can't do that in a list comp:

I have a couple of points to make with my question:

 * We are seeing the reduplication of a large subset of Python's
   facilities. I really wonder if the coroutine fad is worth the price.

 * I don't think bulk iteration in asynchronous programming is ever that
   great of an idea. You want to be prepared for more than one possible
   stimulus in any given state. IOW, a state machine matrix might be
   sparse but it is never diagonal.


Marko



More information about the Python-list mailing list