On Sat, May 24, 2008 at 11:14 PM, Charles R Harris <[EMAIL PROTECTED]> wrote:
> It used to be stay in type and has been changed, and I don't disagree with > that, it was discussed on the list. Nevertheless, booleans are different, > both their own kind and integers. But my problem is not convenience, my > problem is the very inconvenient one of writing comprehensive tests, and for > that the desired behavior has to be specified; it can't simply be taken as > whatever currently happens. Fine. I have verified that the current behaviors you have mentioned are intended. If you want a more concise specification of the special cases, it is this: add.reduce() (and consequently sum()) is the special case. In that context, bool_s are treated as integers, and the integer dtypes plus bool_ use the default integer dtype for the accumulator to forestall overflow in the most common usage. Everything else should follow the generic rules. When bool_s are operated with bool_s, +*- take on Boolean algebraic meanings. When a bool_ is cast to another dtype, True->1 and False->0. bool_ is not part of the integer "kind" so the generic cross-kind rules apply when operations combine bool_s with integers. Does that help? -- Robert Kern "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 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion