December 2000
Intermediate to advanced
816 pages
16h 57m
English
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 | • | • | • | • | • | • | • | • |
Read now
Unlock full access