On Fri, Dec 6, 2013 at 1:46 PM, Alan G Isaac <alan.is...@gmail.com> wrote:

> On 12/6/2013 1:35 PM, josef.p...@gmail.com wrote:
> > unary versus binary minus
>
> Oh right; I consider binary `-` broken for
> Boolean arrays. (Sorry Alexander; I did not
> see your entire issue.)
>
>
> > I'd rather write ~ than unary - if that's what it is.
>
> I agree.  So I have no objection to elimination
> of the `-`.


It looks like we are close to reaching a consensus on the following points:

1. * is well-defined on boolean arrays and may be used in preference of &
in code that is designed to handle 1s and 0s of any dtype in addition to
booleans.

2. + is defined consistently with * and the only issue is the absence of
additive inverse.  This is not a problem as long as presence of - does not
suggest otherwise.

3. binary and unary minus should be deprecated because its use in
expressions where variables can be either boolean or numeric would lead to
subtle bugs.  For example -x*y would produce different results from -(x*y)
depending on whether x is boolean or not.  In all situations, ^ is
preferable to binary - and ~ is preferable to unary -.

4. changing boolean arithmetics to auto-promotion to int is precluded by a
significant use-case of boolean matrices.
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to