[Python-Dev] PEP 492 vs. PEP 3152, new round (original) (raw)
Ethan Furman ethan at stoneleaf.us
Thu Apr 30 18:15:41 CEST 2015
- Previous message (by thread): [Python-Dev] PEP 492 vs. PEP 3152, new round
- Next message (by thread): [Python-Dev] PEP 492 vs. PEP 3152, new round
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 04/29, Yury Selivanov wrote:
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.
Both you and Paul are correct on this, thank you. The proper resolution of
await -coro()
is indeed to get the result of coro(), call it's neg method, and then await on that.
And that is perfectly reasonable, and should not be a SyntaxError; what it might be is an AttributeError (no neg method) or an AsyncError (neg returned non-awaitable object), or might even just work [1]... but it definitely should /not/ be a SyntaxError.
--
Ethan
[1] http://stackoverflow.com/q/7719018/208880
- Previous message (by thread): [Python-Dev] PEP 492 vs. PEP 3152, new round
- Next message (by thread): [Python-Dev] PEP 492 vs. PEP 3152, new round
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]