Probably to explain this better is to recognize that type promotion is happening here. The boolean array is being promoted to an integer array because that is the "wider" of the two array dtypes.
On Wed, Sep 30, 2026 at 9:35 AM Joren Hammudoglu via NumPy-Discussion <[email protected]> wrote: > > Yes that's right: on boolean ndarrays (and only on boolean ndarrays), > logical_and and bitwise_and are equivalent > > On Wed, 30 Sept 2026 at 15:17, zhong.ann--- via NumPy-Discussion > <[email protected]> wrote: >> >> Hi Joren, >> Please check in the link >> https://numpy.org/doc/stable/reference/generated/numpy.logical_and.html#numpy.logical_and >> It is said that "The & operator can be used as a shorthand for >> np.logical_and on boolean ndarrays." >> Thank you. >> _______________________________________________ >> NumPy-Discussion mailing list -- [email protected] >> To unsubscribe send an email to [email protected] >> https://mail.python.org/mailman3//lists/numpy-discussion.python.org >> Member address: [email protected] > > _______________________________________________ > NumPy-Discussion mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3//lists/numpy-discussion.python.org > Member address: [email protected] _______________________________________________ NumPy-Discussion mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/numpy-discussion.python.org Member address: [email protected]
