On Wed, Apr 29, 2015 at 7:07 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:
[...]
Yeah, I'm coming around to the idea. For the async pseudo-keyword, I
can see that the proposal only allows its use in cases that were
previously entirely illegal, but I'm not yet clear on how the PEP
proposes to avoid changing the meaning of the following code:

    x = await(this_is_a_function_call)

Unless I'm misreading the proposed grammar in the PEP (which is
entirely possible), I believe PEP 492 would reinterpret that as:

    x = await this_is_not_a_function_call_any_more

Ah, but here's the other clever bit: it's only interpreted this way *inside* a function declared with 'async def'. Outside such functions, 'await' is not a keyword, so that grammar rule doesn't trigger. (Kind of similar to the way that the print_function __future__ disables the keyword-ness of 'print', except here it's toggled on or off depending on whether the nearest surrounding scope is 'async def' or not. The PEP could probably be clearer about this; it's all hidden in the Transition Plan section.)

--
--Guido van Rossum (python.org/~guido)