Hi Sebastian and Chuck,

Thanks for the response! (Sorry about the formatting in my original post, I 
wasn't familiar with how to display code in this setting).

I think keeping + as "logical or" and * as "logical and" on np.bool_ types is 
fine, although redundant given that | and & provide this functionality and 
potentially misleading given the different behavior from the native Python 
bool; however, I could see it being too painful of a migration within v1.* 
numpy.

I think my main point of contention is that division and exponentiation aren't 
well defined operations on np.bool_, at least as currently defined, and they 
should raise errors like subtraction. Raising those errors would have caught 
the problem I ran into when trying to taking the mean of multiple ndarrays of 
dtype=np.bool_. I'm not sure what the realistic use case is to have 
division/exp. return a float/int, especially when +/* return np.bool_ and 
subtraction throws an error.

Sebastian, you stated:
"N.B.:  I have changed that logic. "Future" ufuncs are now reversed.
They will default to an error rather than using the `int8`
implementation."

So is the division/exp. issue that I described with np.bool_ solved in future 
releases?

Happy to help out on implementation/formalizing a proposal!

FWIW, I suppose you could change + to XOR. Then np.bool_ would be a field 
(isomorphic to Z/2Z) and then you could reasonably define - and /. (Although + 
would be equivalent to - and * would be equivalent to /, which would probably 
be confusing to most users.)

Best,
Jacob
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to