Table C.1 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.
Operator | Int | long | float | complex | string | list | tuple | dictionary |
---|---|---|---|---|---|---|---|---|
[] | • | • | • | |||||
[:] | • | • | • | |||||
** | • | • | • | • | ||||
+† | • | • | • | • | ||||
-† | • | • | • | • | ||||
~† | • | • | ||||||
* | • | • | • | • | • | • | • | |
/ | • | • | • | • | ||||
% | • | • | • | • | • | |||
+ | • | • | • | • | • | • | • | |
- | • | • | • | • | ||||
<< | • | • | ||||||
>> | • | • | ||||||
& | • | • | ||||||
^ | • | • | ||||||
| | • | • | ||||||
< | • | • | • | • | • | • | • | • |
> | • | • | • | • | • | • | • | • |
<= | • | • | • | • | • | • | • | • |
>= | • | • | • | • | • | • | • | • |
== | • | • | • | • | • | • | • | • |
!= | • | • | • | • | • | • | • | • |
<> | • | • | • | • | • | • | • | • |
is | • | • | • | • | • | • | • | • |
is not | • | • | • | • | • | • | • | • |
in | • | • | • | |||||
not in | • | • | • | |||||
not† | • | • | • | • | • | • | • | • |
and | • | • | • | • | • | • | • | • |
or | • | • | • | • | • | • | • | • |