[Numpy-discussion] ufunc oddities
Sat May 24 22:17:19 CDT 2008
On Sat, May 24, 2008 at 10:15 PM, Charles R Harris
> On Sat, May 24, 2008 at 9:11 PM, Robert Kern <firstname.lastname@example.org> wrote:
>> On Sat, May 24, 2008 at 10:06 PM, Robert Kern <email@example.com>
>> > On Sat, May 24, 2008 at 10:02 PM, Charles R Harris
>> > <firstname.lastname@example.org> wrote:
>> >> So what about the rule that the array type takes precedence over the
>> >> scalar
>> >> type? That is broken for booleans.
>> > Yes, and if it wasn't an intentional special case (I don't recall
>> > discussing it on the list, but it might have been), then it's a bug
>> > and suitable for changing. The other behaviors are intentional and
>> > thus not suitable for changing.
>> Nope, I'm wrong. I just doublechecked the manual. bool_ is separate
>> from number on the tree of dtypes, so bool_ + int_ is a cross-kind
>> operation and the scalarness of the int_ is not a concern. E.g.
>> array([1, 2]) + 3.0 has similar behavior. This is not an
> You are confusing promotion between kinds with promotion within kinds. So in
> this view, bool is not an integer type.
Take a look at the tree. bool_ does not descend from integer.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion