LernerPython blog, from Reuven... Note

LernerPython blog, from Reuven Lerner: Python | operator: Bitwise or and dict merging with __or__

In Python, we use “or” for conditions. | is bitwise (not boolean) “or”:x = 10 # 0b1010 y = 13 # 0b1101x | y # 15, or 0b1111| runs __or__. On dicts, | combines. d1 = {'a':10, 'b':2} d2 = {'b':10, 'c':30} d1 | d2 # {'a': 10, 'b': 10, 'c': 30}, right side wins
CdXz5zHNQW_2sq8WLJei2.png