Hi,
 

On Mon, 9 Jul 2007, Timothy Hochberg apparently wrote:
> Why not simply use & and | instead of + and *?

A couple reasons, none determinative.
1. numpy is right a Python is wrong it this case

I don't think I agree with this. Once you've decided to make Boolean a subclass of Int, then Python's behavior seems to be the most sensible. One could argue (and people did) about whether that was a good choice, but it's useful for a lot of practical applications. In any event, given that Boolean subclasses Int, I think the current behavior is probably for the best.


If bool subclasses int, this does not enforce True+True=2. Never. Boolean operation live in the Boole algebra and that's it. It's not the case with integers that cannot be represented with int.
Now, if you take the algebra point of view, which is the point here, for a scientific application, you have to have True+True = True.
 
Matthieu