[issue44692] Const folding in parser with negative numbers doesn't match float/int behaviour
Tim Peters
report at bugs.python.org
Wed Jul 21 01:25:37 EDT 2021
Tim Peters <tim at python.org> added the comment:
The binary power operator (`**`) has higher precedence than the unary negation operator (`-`).
That is, -x**y groups as -(x**y).
Not a bug - that's how it was designed and how it's documented.
Note that this isn't novel, either. For example, to give just one example of many, that's how Maxima does it too:
(%i1) -2**3;
(%o1) -8
----------
nosy: +tim.peters
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44692>
_______________________________________
More information about the Python-bugs-list
mailing list