7 Apr
2016
7 Apr
'16
7:46 a.m.
Hello, Booleans currently have reasonable overrides for the bitwise binary operators:
True | False True True & False False True ^ False True
However, the same cannot be said of bitwise unary complement, which returns rather useless integer values:
~False -1 ~True -2
Numpy's boolean type does the more useful (and more expected) thing:
~np.bool_(True) False
How about changing the behaviour of bool.__invert__ to make it in line with the Numpy boolean? (i.e. bool.__invert__ == operator.not_) Regards Antoine.