[Numpy-discussion] adding booleans

Pauli Virtanen pav at iki.fi
Sat Jun 8 05:23:50 EDT 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