7 Apr
2016
7 Apr
'16
8:15 a.m.
On Thu, 7 Apr 2016 09:00:36 +0100 Mark Dickinson <dickinsm@gmail.com> wrote:
On Thu, Apr 7, 2016 at 8:46 AM, Antoine Pitrou <solipsis@pitrou.net> wrote:
Booleans currently have reasonable overrides for the bitwise binary operators:
True | False True True & False False True ^ False True
All those are consistent with bool being a subclass of int, in the sense that (for example) `int(True | False)` is identical to `int(True) | int(False)`.
However, the return type (bool in one place, int in another one) is inconsistent, and the user-visible semantics are confusing... Apparently someone went to the trouble of overriding __and__, __or__ and __xor__ for booleans, which is why it looks unexpected to leave __invert__ alone. Regards Antoine.