[Numpy-discussion] ufunc oddities
Charles R Harris
Sat May 24 23:14:57 CDT 2008
On Sat, May 24, 2008 at 10:08 PM, Alan G Isaac <email@example.com> wrote:
> > On Sat, May 24, 2008 at 9:21 PM, Alan G Isaac <firstname.lastname@example.org>
> >> 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.)
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion