[issue31519] Negative number raised to even power is negative (-1 ** even = negative)

R. David Murray report at bugs.python.org
Tue Sep 19 10:57:50 EDT 2017


R. David Murray added the comment:

You are being tripped up by operator precedence:

>>> -1**2
-1
>>> (-1)**2
1

----------
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31519>
_______________________________________


More information about the Python-bugs-list mailing list