On Sun, 2017-06-25 at 18:59 +0200, Julian Taylor wrote:
> On 25.06.2017 18:45, Stefan van der Walt wrote:
> > Hi Chuck
> > 
> > On Sun, Jun 25, 2017, at 09:32, Charles R Harris wrote:
> > > The boolean binary '-' operator was deprecated back in NumPy 1.9
> > > and
> > > changed to an error in 1.13. This caused a number of failures in
> > > downstream projects. The choices now are to continue the
> > > deprecation
> > > for another couple of releases, or simply give up on the change.
> > > For
> > > booleans,  `a - b` was implemented as `a xor b`, which leads to
> > > the
> > > somewhat unexpected identity `a - b == b - a`, but it is a handy
> > > operator that allows simplification of some functions,
> > > `numpy.diff`
> > > among therm. At this point I'm inclined to give up on the
> > > deprecation
> > > and retain the old behavior. It is a bit impure but perhaps we
> > > can
> > > consider it a feature rather than a bug.
> > 
> > What was the original motivation behind the deprecation?  `xor`
> > seems
> > like exactly what one would expect when subtracting boolean arrays.
> > 
> > But, in principle, I'm not against the deprecation (we've had to
> > fix a
> > few problems that arose in skimage, but nothing big).
> > 
> > Stéfan
> > 
> > 
> 
> I am against this deprecation for apparently cosmetic reasons.
> Is there any practical drawback in that it makes subtraction
> commutative
> for booleans?
> 
> numpy should not be imposing change of style when the existing sub
> par
> historical style does not cause actual bugs.
> 
> While I don't like it I can accept a deprecation warning that will
> never
> be acted upon.

Dunno, that is also weird, then a UserWarning might even be better ;),
but more visible....

For the unary minus, there are good reasons. For subtract, I don't
remember really, but I don't think there was any huge argument for it.
Probably it was mostly that many feel that:
`False - True == -1` as is the case in python while we have:
`np.False_ - np.True_ == np.True_`.
And going to a deprecation would open up that possibility (though maybe
you could go there directly). Not that I am convinced of that option.

So, I don't mind much either way, but unless there is a concrete plan
with quite a bit of support we should maybe just go with the
conservative option.

- Sebastian


> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to