This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients anthonypjshaw, lys.nikolaou, pablogsal, steven.daprano, tim.peters
Date 2021-07-21.05:26:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1626845197.24.0.498211167089.issue44692@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2021-07-21 05:26:37steven.dapranosetrecipients: + steven.daprano, tim.peters, anthonypjshaw, lys.nikolaou, pablogsal
2021-07-21 05:26:37steven.dapranosetmessageid: <1626845197.24.0.498211167089.issue44692@roundup.psfhosted.org>
2021-07-21 05:26:37steven.dapranolinkissue44692 messages
2021-07-21 05:26:37steven.dapranocreate