PEP 492: isn't the "await" redundant?

Kouli dev at kou.li
Sat Aug 27 15:33:29 EDT 2016


Thank you for all your answers. After all, I am more confident with
the current syntax.

The most important reason for 'await' to me now is the fact you quite
_often_ need to prepare the 'awaitable' object to wait for it later
(like the ChrisA's example with print()), i.e. split the expression
into more lines:

    fut = coro(x)
    ....
    await fut

I supposed it to be only a minor use case (compared to 'await
coro(x)'), but I learned it isn't. Every time you need to "wait for
more than one thing" (more than one 'future'), you also need the
split. Not only for parallel branching, but also even for simple async
operations combined with timeout - asyncio.wait_for() etc. And I
prefer the explicit 'await' for simple waiting to special syntax for
spliting (i.e. do simple waiting without 'await' as was the proposal
at top of this thread - and - introduce more complicated syntax for
split - something like functools.partial(coro, x)).

Kouli



More information about the Python-list mailing list