Re: [Numpy-discussion] Boolean binary '-' operator

2017-06-28 Thread Marten van Kerkwijk
My two ¢: keep things as they are. There is just two much code that
uses the C definition of bools, 0=False, 1=True. Coupled with casting
every outcome that is unequal to 0 as True, * as AND, + as OR, and -
as XOR makes sense (and -True would indeed be True, but I'm quite
happy to have that one removed...).

I lost track a little, but isn't this way also consistent with python,
the one difference being that numpy does an implicit cast to bool on
the result?

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


Re: [Numpy-discussion] Boolean binary '-' operator

2017-06-28 Thread Nathan Goldbaum
Just as a comment: It would be really nice if NumPy could slow down the
pace of deprecations, or at least make the warnings about deprecations more
visible. It seems like every release breaks some subset of our test suite
(we only had one or two cases of using the binary - operator on boolean
arrays so it wasn't a big deal this time). For projects that don't have
resources for ongoing maintenance this is a recipe for bitrot...

On Wed, Jun 28, 2017 at 9:48 AM, Marten van Kerkwijk <
m.h.vankerkw...@gmail.com> wrote:

> My two ¢: keep things as they are. There is just two much code that
> uses the C definition of bools, 0=False, 1=True. Coupled with casting
> every outcome that is unequal to 0 as True, * as AND, + as OR, and -
> as XOR makes sense (and -True would indeed be True, but I'm quite
> happy to have that one removed...).
>
> I lost track a little, but isn't this way also consistent with python,
> the one difference being that numpy does an implicit cast to bool on
> the result?
>
> -- Marten
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] Boolean binary '-' operator

2017-06-28 Thread Marten van Kerkwijk
About visibility of deprecations: this is *very* tricky - if we make
it more visible, every user is going to see deprecation warnings all
the time, about things they can do nothing about, because they occur
inside other packages. I think in the end the only choice is to have
automated testing that turns warnings into errors, so that these
warnings are caught early enough.

That said, I've certainly taken note of this as an example of the
importance of not changing things just because the current
implementation is not quite logical; there should be a real benefit to
the change. That said, in fairness, I'd argue at least a few of the
deprecation warnings are the result of dealing with bit-rot within
numpy!

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


Re: [Numpy-discussion] Boolean binary '-' operator

2017-06-28 Thread josef . pktd
On Wed, Jun 28, 2017 at 10:48 AM, Marten van Kerkwijk <
m.h.vankerkw...@gmail.com> wrote:

> My two ¢: keep things as they are. There is just two much code that
> uses the C definition of bools, 0=False, 1=True. Coupled with casting
> every outcome that is unequal to 0 as True, * as AND, + as OR, and -
> as XOR makes sense (and -True would indeed be True, but I'm quite
> happy to have that one removed...).
>

I'm also in favor of practicality beats mathematical purity.

AFAIK, the hybrid behavior between boolean and the diff/sum/dot behavior
works pretty well when working, e.g., with masks, as for example in masked
array stats.

Josef



>
> I lost track a little, but isn't this way also consistent with python,
> the one difference being that numpy does an implicit cast to bool on
> the result?
>
> -- Marten
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion