Precidence of unary plus/minus relative to exponentiation
Batista, Facundo
FBatista at uniFON.com.ar
Tue Apr 1 14:54:56 EST 2003
#- >>> -2.0**2.0
#- -4.0
#-
#- Python's operator predicence is causing this to be interpreted as:
#-
#- >>> -(2.0**2.0)
It's OK, because the minus and the plus are the last verified signs, in
Python and everywhere else, as far I know.
#- rather than the normal mathematical precidence, which would give
#-
#- >>> (-2.0)**2.0
No, no, no. In "everyday math" if you want to elevate the -2 to 2, you need
to put the brackets explicitly.
.elm.
More information about the Python-list
mailing list