[Python-Dev] PEP 492 vs. PEP 3152, new round

Greg Ewing greg.ewing at canterbury.ac.nz
Sat Apr 25 06:39:37 CEST 2015


Guido van Rossum wrote:
> Yury, could you tweak the syntax for `await` so that we can write the 
> most common usages without parentheses? In particular I'd like to be 
> able to write
> ```
> return await foo()
> with await foo() as bar: ...
> foo(await bar(), await bletch())
> ```

Making 'await' a prefix operator with the same precedence
as unary minus would allow most reasonable usages, I think.

The only reason "yield from" has such a constrained syntax
is that it starts with "yield", which is similarly constrained.
Since 'await' is a brand new keyword isn't bound by those constraints.

-- 
Greg


More information about the Python-Dev mailing list