[Python-ideas] Changing the meaning of bool.__invert__

Joseph Martinot-Lagarde contrebasse at gmail.com
Thu Apr 7 12:00:20 EDT 2016


Ethan Furman <ethan at ...> writes:

> > --> ~False
> > -1
> >  --> ~True
> > -2
> >
> No.  bool is a subclass of int, and changing that now would be a serious 
> breach of backward-compatibility, not to mention breaking existing code 
> for no good reason.

I get that "technically" it would be a backward incompatible change, but any
code that relies on `~True == -2` has other problems than backward
compatibility.



More information about the Python-ideas mailing list