|
| 1 | + Overview of Magic Methods |
| 2 | + Binary Operators |
| 3 | + Operator Method |
| 4 | ++ object.__add__(self, other) |
| 5 | + |
| 6 | +- object.__sub__(self, other) |
| 7 | + |
| 8 | +* object.__mul__(self, other) |
| 9 | + |
| 10 | +// object.__floordiv__(self, other) |
| 11 | + |
| 12 | +/ object.__truediv__(self, other) |
| 13 | + |
| 14 | +% object.__mod__(self, other) |
| 15 | + |
| 16 | +** object.__pow__(self, other[, modulo]) |
| 17 | + |
| 18 | +<< object.__lshift__(self, other) |
| 19 | + |
| 20 | + >> object.__rshift__(self, other) |
| 21 | +
|
| 22 | +& object.__and__(self, other) |
| 23 | + |
| 24 | +^ object.__xor__(self, other) |
| 25 | + |
| 26 | +| object.__or__(self, other) |
| 27 | + |
| 28 | + Extended Assignments |
| 29 | + Operator Method |
| 30 | ++= object.__iadd__(self, other) |
| 31 | + |
| 32 | +-= object.__isub__(self, other) |
| 33 | + |
| 34 | +*= object.__imul__(self, other) |
| 35 | + |
| 36 | +/= object.__idiv__(self, other) |
| 37 | + |
| 38 | +//= object.__ifloordiv__(self, other) |
| 39 | + |
| 40 | +%= object.__imod__(self, other) |
| 41 | + |
| 42 | +**= object.__ipow__(self, other[, modulo]) |
| 43 | + |
| 44 | +<<= object.__ilshift__(self, other) |
| 45 | + |
| 46 | + >>= object.__irshift__(self, other) |
| 47 | +
|
| 48 | +&= object.__iand__(self, other) |
| 49 | + |
| 50 | +^= object.__ixor__(self, other) |
| 51 | + |
| 52 | +|= object.__ior__(self, other) |
| 53 | + |
| 54 | + Unary Operators |
| 55 | + Operator Method |
| 56 | +- object.__neg__(self) |
| 57 | + |
| 58 | ++ object.__pos__(self) |
| 59 | + |
| 60 | +abs() object.__abs__(self) |
| 61 | + |
| 62 | +~ object.__invert__(self) |
| 63 | + |
| 64 | +complex() object.__complex__(self) |
| 65 | + |
| 66 | +int() object.__int__(self) |
| 67 | + |
| 68 | +long() object.__long__(self) |
| 69 | + |
| 70 | +float() object.__float__(self) |
| 71 | + |
| 72 | +oct() object.__oct__(self) |
| 73 | + |
| 74 | +hex() object.__hex__(self |
| 75 | + |
| 76 | + Comparison Operators |
| 77 | + Operator Method |
| 78 | +< object.__lt__(self, other) |
| 79 | + |
| 80 | +<= object.__le__(self, other) |
| 81 | + |
| 82 | +== object.__eq__(self, other) |
| 83 | + |
| 84 | +!= object.__ne__(self, other) |
| 85 | + |
| 86 | + >= object.__ge__(self, other) |
| 87 | +
|
| 88 | + > object.__gt__(self, other) |
0 commit comments