Message403196
> 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. |
|
Date |
User |
Action |
Args |
2021-10-05 06:16:57 | xmorel | set | recipients:
+ xmorel, eric.smith, nmadurkar |
2021-10-05 06:16:57 | xmorel | set | messageid: <1633414617.96.0.248743777253.issue45368@roundup.psfhosted.org> |
2021-10-05 06:16:57 | xmorel | link | issue45368 messages |
2021-10-05 06:16:57 | xmorel | create | |
|