<div><div>Hi,<br> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><span class="q"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

On Mon, 9 Jul 2007, Timothy Hochberg apparently wrote:<br>> Why not simply use & and | instead of + and *?<br><br>A couple reasons, none determinative.<br>1. numpy is right a Python is wrong it this case</blockquote>

</span><div><br>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.
</div></div></blockquote><div><br><br>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.
<br>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.<br> </div></div>Matthieu<br><br>