A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2015-April/139717.html below:

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

[Python-Dev] PEP 492 vs. PEP 3152, new roundGuido van Rossum guido at python.org
Thu Apr 30 19:38:16 CEST 2015
On Thu, Apr 30, 2015 at 9:15 AM, Ethan Furman <ethan at stoneleaf.us> wrote:

> [...]
> 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.
>

Why not? Unlike some other languages, Python does not have uniform
priorities for unary operators, so it's reasonable for some unary
operations to have a different priority than others, and certain things
will be SyntaxErrors because of that. E.g. you can write "not -x" but you
can't write "- not x". This is because they have different priorities:
'not' has a very low priority so it binds less tight than comparisons
(which bind less tight than arithmetic), but '-' has a high priority.
(There are other quirks, e.g. -2**2 means -(2**2) and you can write 2**-2;
but you can't write 2**not x.)

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150430/b5586421/attachment-0001.html>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4