In addition to the core arithmetic and comparison operators, we have a group of additional operators that (generally) we only define for the numbers.Integral values. As we're not defining integral values, we can avoid these special methods:
Method |
Operator |
object.__lshift__(self, other) |
<< |
object.__rshift__(self, other) |
>> |
object.__and__(self, other) |
& |
object.__xor__(self, other) |
^ |
object.__or__(self, other) |
| |
Also, there are reflected versions of these operators:
Method |
Operator |
object.__rlshift__(self, other) |
<< |
object.__rrshift__(self, other) |
>> |
object.__rand__(self, other) |
& |
object.__rxor__(self, other) |
^ |
object.__ror__(self, other) |
| |
Additionally, there is a unary operator for a bit-wise inverse of the value:
Method... |