<br><br><div><span class="gmail_quote">On 7/7/07, <b class="gmail_sendername">Alan G Isaac</b> <<a href="mailto:aisaac@american.edu">aisaac@american.edu</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Sat, 7 Jul 2007, Charles R Harris apparently wrote:<br>> In [60]: a<br>> Out[60]: array([ True,  True,  True,  True], dtype=bool)<br>> In [61]: a + a<br>> Out[61]: array([ True,  True,  True,  True], dtype=bool)
<br><br>Yea!<br>Behaves like a boolean array.<br>And for multiplication to.<br>And in boolean matrices, powers work right.<br>(I use this.)<br><br><br>> In [62]: a + 1<br>> Out[62]: array([2, 2, 2, 2])<br><br>Yea!<br>
Coercion to int, as expected.<br><br><br>> In [66]: True + True<br>> Out[66]: 2<br><br>Boo!<br>Hopefully Python will "fix" this one day.</blockquote><div><br>It will almost certainly not. And the fact that numpy and Python are inconsistent this way gives my the creeps.
<br><br>Why not simply use & and | instead of + and *? <br></div></div><br><br clear="all"><br>-- <br>.  __<br>.   |-\<br>.<br>.  <a href="mailto:tim.hochberg@ieee.org">tim.hochberg@ieee.org</a>