[SciPy-dev] [SciPy-user] operations on int8 arrays
Fernando.Perez at colorado.edu
Wed Oct 19 15:55:47 CDT 2005
Travis Oliphant wrote:
> Or, this could simply be the default when calling the .sum method (which
> is add.reduce under the covers). The reduce method could stay with the
> default of the integer type.
> Obviously, it's going to give "unexpected" results to somebody.
> Automatic upcasting can have its downsides. But, perhaps in this case
> (integer reductions), it is better to do the upcasting. What do people
I've personally always been of the opinion that accumulator methods are one
case where automatic upcasting is justified. Since not doing it is almost
guaranteed to produce incorrect results in most cases (esp. for small bit-size
types), I'm +1 on upcasting on this one.
I agree that in general we shouldn't upcast silently, but I think this is a
case of 'practicality beats purity'.
Think of it this way: almost anyone writing the equivalent to .sum() manually
in C would write this with a wide enough accumulator, so I think it's OK for
scipy to do the same.
Just my 1e-2.
More information about the Scipy-dev