Python Bitwise OR

Python bitwise OR is done with the | operator.

>>> 38 | 51
55

The way it works is that it will do an OR operation at the bit level. Each bit of the 32 bit integer is compared with the bit in the same position on the other 32 bit integer. If either of the bits is 1, the result will be a 1, otherwise the result is a 0. So in the above example:

38 = 00000000 00000000 00000000 00100110
51 = 00000000 00000000 00000000 00110011
   = 00000000 00000000 00000000 00110111 = 55

Bitwise OR can only be done with integers

>>> 3.2 | 5.5
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for &: 'float' and 'float'