[Numpy-discussion] np.bool_ vs Python bool behavior

2022-03-12 Thread Jacob Reinhold
A pain point I ran into a while ago was assuming that an np.ndarray with dtype=np.bool_ would act similarly to the Python built-in boolean under addition. This is not the case, as shown in the following code snippet: >>> np.bool_(True) + True True >>> True + True 2 In fact, I'm somewhat confuse

[Numpy-discussion] Re: np.bool_ vs Python bool behavior

2022-03-16 Thread Jacob Reinhold
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 f