[$] The troubles with Boolean inversion in Python
The Python bitwise-inversion (or complement) operator, "~", behavespretty much as expected when it is applied to integers-it toggles everybit, from oneto zero and vice versa. It might be expected that applying theoperator to a non-integer, a boolfor example, would raise a TypeError, but, because thebool type is really an intin disguise, the complement operator is allowed, at least for now. Fornearly 15years (and perhaps longer), there have been discussions about theoddity of that behavior and whether it should be changed. Eventually,that resulted in the "feature" being deprecated, producing a warning, with removal slated forPython3.16 (due October 2027). That has led to some reconsideration and thedeprecation may itself be deprecated.