We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

operator-invert

The unary ~ (invert) operator yields the bit-wise inversion of its plain or long integer argument. The bit-wise inversion of x is defined as -(x+1). It only applies to integral numbers.

Tf the argument does not have the proper type, a TypeError exception is raised.

To support this operator in your own classes, implement the __invert__ method.