[Numpy-discussion] Boolean binary '-' operator

josef.pktd at gmail.com josef.pktd at gmail.com
Wed Jun 28 18:06:02 EDT 2017


On Wed, Jun 28, 2017 at 10:48 AM, Marten van Kerkwijk <
m.h.vankerkwijk at gmail.com> wrote:

> My two ¢: keep things as they are. There is just two much code that
> uses the C definition of bools, 0=False, 1=True. Coupled with casting
> every outcome that is unequal to 0 as True, * as AND, + as OR, and -
> as XOR makes sense (and -True would indeed be True, but I'm quite
> happy to have that one removed...).
>

I'm also in favor of practicality beats mathematical purity.

AFAIK, the hybrid behavior between boolean and the diff/sum/dot behavior
works pretty well when working, e.g., with masks, as for example in masked
array stats.

Josef



>
> I lost track a little, but isn't this way also consistent with python,
> the one difference being that numpy does an implicit cast to bool on
> the result?
>
> -- Marten
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20170628/79c88385/attachment.html>


More information about the NumPy-Discussion mailing list