|
|
@@ -5,7 +5,7 @@ label: operator
|
|
|
|
|
|
The operator module exports a set of efficient functions corresponding to the intrinsic operators of Python. For example, `operator.add(x, y)` is equivalent to the expression `x+y`. Many function names are those used for special methods, without the double underscores.
|
|
|
|
|
|
-## Supported operators
|
|
|
+## Mapping Operators to Functions
|
|
|
|
|
|
| Operation | Syntax | Function |
|
|
|
| --- | --- | --- |
|
|
|
@@ -39,3 +39,18 @@ The operator module exports a set of efficient functions corresponding to the in
|
|
|
| Index Assignment | `a[b] = c` | `setitem(a, b, c)` |
|
|
|
| Index Deletion | `del a[b]` | `delitem(a, b)` |
|
|
|
|
|
|
+
|
|
|
+## In-place Operators
|
|
|
+| Operation | Syntax | Function |
|
|
|
+| --- | --- | --- |
|
|
|
+| Addition | `a += b` | `iadd(a, b)` |
|
|
|
+| Subtraction | `a -= b` | `isub(a, b)` |
|
|
|
+| Multiplication | `a *= b` | `imul(a, b)` |
|
|
|
+| Division | `a /= b` | `itruediv(a, b)` |
|
|
|
+| Division | `a //= b` | `ifloordiv(a, b)` |
|
|
|
+| Modulo | `a %= b` | `imod(a, b)` |
|
|
|
+| Bitwise AND | `a &= b` | `iand(a, b)` |
|
|
|
+| Bitwise OR | `a |= b` | `ior(a, b)` |
|
|
|
+| Bitwise XOR | `a ^= b` | `ixor(a, b)` |
|
|
|
+| Left Shift | `a <<= b` | `ilshift(a, b)` |
|
|
|
+| Right Shift | `a >>= b` | `irshift(a, b)` |
|