[Numpy-discussion] Boolean binary '-' operator

Eric Wieser wieser.eric+numpy at gmail.com
Tue Jun 27 19:35:13 EDT 2017


It seems to me that after a healthy post-deprecation cycle, and if we
choose to keep the Z/2 meaning of __sub__, it might be worth reintroducing
__neg__ as a no-op? AFAICT, this is consistent with the Z/2 interpretation?

Eric

On Wed, 28 Jun 2017 at 00:08 Nathaniel Smith <njs at pobox.com> wrote:

> On Tue, Jun 27, 2017 at 3:09 PM, Robert Kern <robert.kern at gmail.com>
> wrote:
> > On Tue, Jun 27, 2017 at 3:01 PM, Benjamin Root <ben.v.root at gmail.com>
> wrote:
> >>
> >> Forgive my ignorance, but what is "Z/2"?
> >
> > https://groupprops.subwiki.org/wiki/Cyclic_group:Z2
> > https://en.wikipedia.org/wiki/Cyclic_group
>
> This might be a slightly better link?
> https://en.wikipedia.org/wiki/Modular_arithmetic#Integers_modulo_n
>
> Anyway, it's a math-nerd way of saying "the integers modulo two", i.e.
> the numbers 0 and 1 with * as AND and + as XOR. But the nice thing
> about Z/2 is that if you know some abstract algebra, then one of the
> most fundamental theorems is that if p is prime then Z/p is a "field",
> meaning that * and + are particularly well-behaved. And 2 is a prime,
> so pointing out that the bools with AND and XOR is the same as Z/2 is
> a way of saying "this way of defining * and + is internally consistent
> and well-behaved".
>
> -n
>
> --
> Nathaniel J. Smith -- https://vorpus.org
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20170627/4f141a3c/attachment-0001.html>


More information about the NumPy-Discussion mailing list