[Numpy-discussion] boolean operations on boolean arrays

Alexander Belopolsky ndarray at mac.com
Sat Apr 12 12:58:34 EDT 2014


On Sat, Apr 12, 2014 at 10:02 AM, Alan G Isaac <alan.isaac at gmail.com> wrote:

> Are there any considerations besides convenience in choosing
> between:
>
> a&b           a*b         logical_and(a,b)
> a|b           a+b         logical_or(a,b)
> ~a            True-a      logical_not(a)
>

Boolean "-" is being deprecated:

https://github.com/numpy/numpy/pull/4105

The choice between &| and *+ is best dictated by what is more natural in
your problem domain and how your functions should treat non-boolean types.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140412/c23479c8/attachment.html>


More information about the NumPy-Discussion mailing list