Movatterモバイル変換
[0]ホーム
5.14 Summary
The following table summarizes the operatorprecedences in Python, from lowestprecedence (least binding) to highest precedence (most binding).Operators in the same box have the same precedence. Unless the syntaxis explicitly given, operators are binary. Operators in the same boxgroup left to right (except for comparisons, which chain from left toright -- see above, and exponentiation, which groups from right toleft).
| Operator | Description |
|---|
| lambda | Lambda expression |
| or | Boolean OR |
| and | Boolean AND |
| notx | Boolean NOT |
| in,notin | Membership tests |
| is,is not | Identity tests |
<,<=,>,>=,<>,!=,== | Comparisons |
| | Bitwise OR |
^ | Bitwise XOR |
& | Bitwise AND |
<<,>> | Shifts |
+,- | Addition and subtraction |
*,/,% | Multiplication, division, remainder |
+x,-x | Positive, negative |
~x | Bitwise not |
** | Exponentiation |
x.attribute | Attribute reference |
x[index] | Subscription |
x[index:index] | Slicing |
f(arguments...) | Function call |
(expressions...) | Binding or tuple display |
[expressions...] | List display |
{key:datum...} | Dictionary display |
`expressions...` | String conversion |
SeeAbout this document... for information on suggesting changes.
[8]ページ先頭