[Numpy-discussion] Should bool_ subclass int?
gael.varoquaux at normalesup.org
Tue Jul 10 10:48:39 EDT 2007
On Tue, Jul 10, 2007 at 10:36:55AM -0400, Alan G Isaac wrote:
> I found Gael's presentation rather puzzling for two reasons.
> 1. It appears to contain a `+` vs. `*` confusion.
> See http://en.wikipedia.org/wiki/Two-element_Boolean_algebra
Damn it. I used math conventions, for "+" and "*" (in math the "+" law of
a ring is the law for which every element has an inverse). I hadn't
realized it was the opposite for intuitive understanding of booleans.
> 2. MUCH more importantly:
> In implementations of TWO, we interpret `-` as unary
> complementation (not e.g. as additive inverse; note True
> does not have one).
Yes, indeed, as the law for which every element has an inverse is "*",
the inverse for the "+" is not defined, and therefore the "-" sign cannot
design it. You are quite right that it is impossible to define "-" on the
boolean set in a way that makes it follow tradition integer operations.
I don't know what the conclusion of this should be in terms of the
Sorry for the noise.
More information about the NumPy-Discussion