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

2015年4月30日 09:17:57 -0700

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
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to