[Numpy-discussion] ufunc oddities

Alan G Isaac aisaac@american....
Sat May 24 23:08:57 CDT 2008

> On Sat, May 24, 2008 at 9:21 PM, Alan G Isaac <aisaac@american.edu> wrote:
>> If you want bools, change the accumulator dtype:: 
>>    >>> x.sum(dtype=bool)

On Sat, 24 May 2008, Charles R Harris apparently wrote:
> Shouldn't that be the other way round? If you want integers, do 
> x.sum(dtype=int). Ints don't sum in float64 by default. 

I was not taking a normative position.
Just illustrating the current behavior.

I think both sides have a point in this discussion.
It sounds like the behavior you like will be costly (in 
time) to implement, so it would have to be substantially 
better to be worth doing.  I personally like it better,
but I worry new users will be startled.  (I suppose
I would address this by always having the default 
accumulator be ``float``, figuring that anyone who does not 
like that will know what to do about it.)


More information about the Numpy-discussion mailing list