[Python-ideas] PEP 530: Asynchronous Comprehensions

Sven R. Kunze srkunze at mail.de
Mon Sep 5 19:27:39 EDT 2016


Hi Yury,

just for my understanding:

On 04.09.2016 01:31, Yury Selivanov wrote:
> We propose to allow the use of ``await`` expressions in both
> asynchronous and synchronous comprehensions::
>
>     result = [await fun() for fun in funcs]
>     result = {await fun() for fun in funcs}
>     result = {fun: await fun() for fun in funcs}
>

This will produce normal lists, sets and dicts, right?

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?

Sven


More information about the Python-ideas mailing list