Closed alwaysmpe closed 1 month ago
The expression -1 ** 0
desugars to -(1 ** 0)
. The existing overloads are correct:
>>> (-1).__pow__(0)
1
>>> -1 ** 0
-1
>>> (-1) ** 0
1
My bad, cheers
python -c 'import ast; print(ast.dump(ast.parse("-1 ** 0"), indent=4))'
:-)
The pow to a literal
0
overload has incorrect literal return.Code:
https://github.com/python/typeshed/blob/1a837277234f12b546d4aa1252e4b44863c0a862/stdlib/builtins.pyi#L284-L287
however,
-1 ** 0 == -1
so this should instead be:although when I do:
this seems weird.
I'm running python 3.12.4 installed on linux using pyenv.