[Numpy-discussion] Should bool_ subclass int?

Alan G Isaac aisaac@american....
Tue Jul 10 10:31:35 CDT 2007


Hi Gael,

More important is the following.


On Tue, 10 Jul 2007, Alan G Isaac apparently wrote: 
>>>> N.array([False])-N.array([True]) 
> array([True], dtype=bool) 
>>>> N.array([False])+(-N.array([True])) 
> array([False], dtype=bool) 

> The second answer is the right one, in this context.  
> I would call this [first!!!] answer a bug. 


Do you agree that the first (!!!) answer is a bug?
(The basis is apparently performed as follows:
integer array subtraction is first performed, and
then nonzero ints are converted to True.  But this
gives the wrong answer and most critically breaks
the equivalence of a-b and a+(-b).)

Cheers,
Alan




More information about the Numpy-discussion mailing list