On 06.09.2016 03:16, Yury Selivanov wrote:

Whereas the following will produce some sort of async lists, sets, and dicts?

    result = [await fun() async for fun in funcs]
    result = {await fun() async for fun in funcs}
    result = {fun: await fun() async for fun in funcs}

If so, how do I read values from an async list/set/dict?

Consider "funcs" to be an asynchronous generator/iterable that produces a sequence of awaitables. The above comprehensions will await on each awaitable in funcs, producing regular list, set, and dict.

So, what's the "async" good for then?


I doubt that anybody ever would write something like that; this is just examples of what the PEP will enable.

Why do you implement it then? :D
Put it differently, why are you sceptic about it?


There is no concept of asynchronous datastructures in Python.

I thought so, that's why I asked. ;) "async def" gives me something async, so I assumed it to be the case here as well.


Cheers,
Sven
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to