async enumeration - possible?

Frank Millman frank at chagford.com
Wed Nov 30 03:29:14 EST 2016


"Marko Rauhamaa"  wrote in message news:87d1hd4d5k.fsf at elektro.pacujo.net...
>
> One of the more useful ones might be:
>
>     o = await anext(ait)
>

Definitely!

But I found it easy to write my own -

async def anext(aiter):
    return await aiter.__anext__()

[...]

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

I am not familiar with your terminology here, so my comment may be way 
off-track.

I use 'bulk iteration' a lot in my app. It is a client/server multi-user 
business/accounting app.

If a user wants to view the contents of a large table, or I want to print 
statements for a lot of customers,  I can request the data and process it as 
it arrives, without blocking the other users.

I find that very powerful.

Frank





More information about the Python-list mailing list