On Sun, Jun 14, 2020 at 9:54 AM Greg Ewing <greg.ew...@canterbury.ac.nz> wrote:
> But this would require reading the programmer's mind, because it's
> quite legitimate to create an iterator and keep it around to be
> yielded from later. Likewise, it's legitimate to create an awaitable
> object and then await it later.
>
> (Personally I think it *shouldn't* be legitimate to do that in
> the case of await, but Guido thinks otherwise, so it is the way
> it is.)
>

If it isn't, then how do you start multiple tasks in parallel?

async def get_thing(id):
    await spam(id)
    await ham(id)
    return await internet()

needed_things = [53, 110, 587]
tasks = [get_thing(id) for id in needed_things]
# ... now what?

Somehow you need to have three tasks run concurrently, and if you
weren't allowed to create an awaitable without immediately awaiting
it, how would you do that?

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/X76TJ4J2PTK4Q2IBR6MACAQCLLE6JE5L/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to