All unary arithmetic (and bit-wise) operations have the same priority:
所有一元算术运算符(和位运算符)有相同的优先级:
The unary -
(minus) operator yields the negation of its
numeric argument.
一元运算符-(减)对其数值型操作数取负.
The unary +
(plus) operator yields its numeric argument
unchanged.
一元运算符+(加)不改变其数值型操作数.
The unary ~
(invert) operator yields the bit-wise inversion
of its plain or long integer argument. The bit-wise inversion of
x
is defined as -(x+1)
. It only applies to integral
numbers.
一元运算符 (取反)对其普通整数或长整数参数求逆(比特级).x的比特级求逆运算定义为-(x+1).它仅仅用于整数型的操作数.
In all three cases, if the argument does not have the proper type, a TypeError exception is raised.
在以上所有的三种情况下, 如果参数的类型不合法, 就会引发一个TypeError异常.