Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

Not a bug, this is due to operator precedence.

It is documented under the power operator:

https://docs.python.org/3/reference/expressions.html#the-power-operator

and in the operator precedence table:

https://docs.python.org/3/reference/expressions.html#operator-precedence

If you want to raise a negative literal to a power, you need parentheses:

    (-2)**2

----------
nosy: +steven.daprano
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44692>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to