This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xmorel
Recipients eric.smith, nmadurkar, xmorel
Date 2021-10-05.06:16:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1633414617.96.0.248743777253.issue45368@roundup.psfhosted.org>
In-reply-to
Content
> 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.
History
Date User Action Args
2021-10-05 06:16:57xmorelsetrecipients: + xmorel, eric.smith, nmadurkar
2021-10-05 06:16:57xmorelsetmessageid: <1633414617.96.0.248743777253.issue45368@roundup.psfhosted.org>
2021-10-05 06:16:57xmorellinkissue45368 messages
2021-10-05 06:16:57xmorelcreate