On Thu, Dec 5, 2013 at 7:33 PM,  <josef.p...@gmail.com> wrote:
> On Thu, Dec 5, 2013 at 5:37 PM, Sebastian Berg
> <sebast...@sipsolutions.net> wrote:
>> Hey,
>>
>> there was a discussion that for numpy booleans math operators +,-,* (and
>> the unary -), while defined, are not very helpful. I have set up a quick
>> PR with start (needs some fixes inside numpy still):
>>
>> https://github.com/numpy/numpy/pull/4105
>>
>> The idea is to deprecate these, since the binary operators |,^,| (and
>> the unary ~ even if it is weird) behave identical. This would not affect
>> sums of boolean arrays. For the moment I saw one "annoying" change in
>> numpy, and that is `abs(x - y)` being used for allclose and working
>> nicely currently.
>
> I like mask = mask1 * mask2
>
> That's what I learned working my way through scipy.stats.distributions
> a long time ago.

* is least problematic case, since there numpy and python bools
already almost agree. (They return the same values, but numpy returns
a bool array instead of an integer array.)

On Thu, Dec 5, 2013 at 8:05 PM, Alan G Isaac <alan.is...@gmail.com> wrote:
> For + and * (and thus `dot`), this will "fix" something that is not broken.
> It is in fact in conformance with a large literature on boolean arrays
> and boolean matrices.

Interesting point! I had assumed that dot() just upcast! But what do
you think about the inconsistency between sum() and dot() on bool
arrays?

-n
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to