3 Answers
+ 4
| is a bitwise or
It operates on binary digits
For instance if you had the number 10 and 13 and you ORed them.
10 = 0000 1010 in binary (as byte)
13 = 0000 1101 in binary (as byte)
The result would be
15 = 0000 1111 in binary (as byte)
A | B | result
0 | 0 | 0
0 | 1 | 1
1 | 0 | 1
1 | 1 | 1
if either of the bit are 1 the resulting bit is 1, otherwise 0.
print(10 | 13) # outputs 15
+ 3
"|" means 3 things in Python:
Either a bitwise-OR operator,
or a set-combine operator,
or "OR" in regex.
+ 2
1- a union operator which used to combine two sets to form a new one containing elements in either = {}.union() method
2 - in regular expressions it means or