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

2022-03-13 Thread Charles R Harris
On Sat, Mar 12, 2022 at 4:53 PM Jacob Reinhold wrote: > 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_(Tru

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

2022-03-13 Thread Charles R Harris
On Sun, Mar 13, 2022 at 10:31 AM Charles R Harris wrote: > > > On Sat, Mar 12, 2022 at 4:53 PM Jacob Reinhold > wrote: > >> 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

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

2022-03-13 Thread Sebastian Berg
Hi Jacob, adding to what Chuck mentioned, a few inline comments if you are interested in some gory details. On Sat, 2022-03-12 at 21:40 +, Jacob Reinhold wrote: > 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