[Numpy-discussion] Should bool_ subclass int?
Alan G Isaac
aisaac at american.edu
Tue Jul 10 11:31:35 EDT 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