Xavier Morel <xavier.mo...@masklinn.net> added the comment:
> True is a boolean so ~True should return False according to me. That's be a BC break for no reason: if you want to invert a boolean you can just `not` it. > True is not the same as 1 For historical reasons, in Python it is: >>> bool.mro() [<class 'bool'>, <class 'int'>, <class 'object'>] >>> True == 1 True >>> False == 0 True So when you call ~True, you're calling `int.__invert__(True)`, which behaves as what it is: the bitwise inverse of a two's-complement signed integer. ---------- nosy: +xmorel _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45368> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com