[Numpy-discussion] ufunc oddities

Charles R Harris charlesr.harris at gmail.com
Sun May 25 00:14:57 EDT 2008


On Sat, May 24, 2008 at 10:08 PM, Alan G Isaac <aisaac at american.edu> wrote:

> > On Sat, May 24, 2008 at 9:21 PM, Alan G Isaac <aisaac at 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.)
>

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.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080524/b869a400/attachment.html>


More information about the NumPy-Discussion mailing list