~ in python will invert the value. The actual method depends on the implementation of __invert__ method of the argument.

Let’s start with the numbers.

~10 # -11
~-10 # 9

~1 # -2
~-1 # 0

~0 # -1

The case for True and False

~True # -2
~False # -1

# which are the same as
~1 # -2
~0 # -1