Bitwise operators
Bitwise operators work on the bits of an integer. They are useful for flags or binary data where each bit carries a separate piece of information.
Turn on and test a flag
Use a left shift to make a mask, a bitwise OR to set that bit, and a bitwise AND to inspect it.
visible = 1 << 2
flags = 0 | visible
print((flags & visible) == visible)
true
The mask identifies the third bit, counting from the low bit. That bit is now set.