[Numpy-discussion] adding booleans

Pauli Virtanen pav@iki...
Sat Jun 8 04:23:50 CDT 2013


08.06.2013 02:48, Nathaniel Smith kirjoitti:
[clip]
> ...yeah weird. My gut reaction is that it's a bug. Addition on bools
> should either be an error, undefined but doable via an implicit upcast
> to int (analogous to calling np.sin on an int array triggering an upcast
> to float), or xor (i.e., addition mod 2).

There are several more sensible choices:

http://en.wikipedia.org/wiki/Boolean_ring



More information about the NumPy-Discussion mailing list