[Python-Dev] PEP 492 vs. PEP 3152, new round (original) (raw)

Yury Selivanov yselivanov.ml at gmail.com
Wed Apr 29 21:27:24 CEST 2015


Hi Nathaniel,

BTW, I'm going to reply to you in the other thread about context-local objects soon. I have some thoughts on the topic.

On 2015-04-29 3:14 PM, Nathaniel Smith wrote:

On Apr 29, 2015 11:49 AM, "Yury Selivanov" <yselivanov.ml at gmail.com> wrote:

Hi Ethan,

On 2015-04-29 2:32 PM, Ethan Furman wrote: On 04/29, Yury Selivanov wrote: On 2015-04-29 1:25 PM, Ethan Furman wrote: cannot also just work and be the same as the parenthesized version. Because it does not make any sense. I obviously don't understand your position that "it does not make any sense" -- perhaps you could explain a bit? What I see is a suspension point that is waiting for the results of coro(), which will be negated (and returned/assigned/whatever). What part of that doesn't make sense? Because you want operators to be resolved in the order you see them, generally. You want '(await -fut)' to: 1. Suspend on fut; 2. Get the result; 3. Negate it. This is a non-obvious thing. I would myself interpret it as: 1. Get fut.neg(); 2. await on it. So I want to make this syntactically incorrect: As a bystander, I don't really care either way about whether await -fut is syntactically valid (since like you say it's semantically nonsense regardless and no one will ever write it). But I would rather like to actually know what the syntax actually is, not just have a list of examples (which kinda gives me perl flashbacks). Is there any simple way to state what the rules for parsing await are? Or do I just have to read the parser code if I want to know that?

There is a summary of grammar changes in the PEP: https://www.python.org/dev/peps/pep-0492/#grammar-updates

You can also see the actual grammar file from the reference implementation: https://github.com/1st1/cpython/blob/await/Grammar/Grammar

Thanks, Yury



More information about the Python-Dev mailing list