[Numpy-discussion] Should bool_ subclass int?

Matthieu Brucher matthieu.brucher@gmail....
Tue Jul 10 07:45:15 CDT 2007


>
> When you talk about algebra - one might have to restrict one self to '|'
> and '&'
> -- not use '+'  and '-'
> E.g.:
> True - True = False   # right !?



Not exactly because - True = + True
So True - True = True + True = True
You have to stay in the algebra the whole time.

# but if:
> True+True         = True.
> # then
> True+True   -False      = True -False   # ????
> # here I'm already lost ... I don't think this can be done in a consistent
> way.
>
> In other words:  a "+" operator  would also need a corresponding "-"
> operator, and that will just look funny.  I think if you want algebra,
> you should restrict yourself to "|" (or) and "&" (and)


When you make computation in the Bool algebra, you use + and * in every math
book. In IT books, you see | and &. As Numpy is scientists oriented, I
suppose that the definition of + and * is correct.

Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20070710/694e866c/attachment.html 


More information about the Numpy-discussion mailing list