[Numpy-discussion] Numeric/numarray compatibility issue

Stephen Walton stephen.walton at csun.edu
Fri Mar 4 09:29:18 CST 2005

Perry Greenfield wrote:

> On Mar 3, 2005, at 12:31 PM, konrad.hinsen at laposte.net wrote:
>>     print n.add.reduce(n.greater(n.arange(128), -1))
>> yields -128, which is not what I would expect.
> I think this has come up in the past,

It has.  I think I commented on it some time back, and the consensus was 
that, as Perry suggested, using .astype(Int32) is the best fix.  I think 
the fact that arithmetic is allowed on booleans without casts is an 
oversight;  standard Python 2.3 allows you to do True+False. Fortran 
would never let you do .TRUE.+.FALSE. :-) .

More information about the Numpy-discussion mailing list