Table B.14 represents the complete set of Python operators and to which standard types they apply. The operators are sorted from highest-to-lowest precedence, with those sharing the same shaded group having the same priority.
Table B.14. Python Operators ( - unary)
Operator[a]
int[b]
long
float
complex
str
list
tuple
dict
set, frozenset[c]
[]
•
•
•
[:]
•
•
•
**
•
•
•
•
+
•
•
•
•
-
•
•
•
•
~
•
•
*
•
•
•
•
•
•
•
/
•
•
•
•
//
•
•
•
•
%
•
•
•
•
•
+
•
•
•
•
•
•
•
-
•
•
•
•
•
<<
•
•
>>
•
•
&
•
•
•
^
•
•
•
|
•
•
•
<
•
•
•
•
•
•
•
•
•
>
•
•
•
•
•
•
•
•
•
<=
•
•
•
•
•
•
•
•
•
>=
•
•
•
•
•
•
•
•
•
==
•
•
•
•
•
•
•
•
•
!=
•
•
•
•
•
•
•
•
•
<>
•
•
•
•
•
•
•
•
•
is
•
•
•
•
•
•
•
•
•
is not
•
•
•
•
•
•
•
•
•
in
•
•
•
•
not in
•
•
•
•
not
•
•
•
•
•
•
•
•
•
and
•
•
•
•
•
•
•
•
•
or
•
•
•
•
•
•
•
•
•
[a] May also include corresponding augmented assignment operators.
[b] Operations involving Boolean types will be performed on the operands as ints.