[Numpy-discussion] ufunc oddities
Charles R Harris
charlesr.harris@gmail....
Sat May 24 22:40:18 CDT 2008
On Sat, May 24, 2008 at 9:35 PM, Nathan Bell <wnbell@gmail.com> wrote:
> On Sat, May 24, 2008 at 10:24 PM, Charles R Harris
> <charlesr.harris@gmail.com> 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.
> >
>
> The default behavior (x.sum() -> int) is more useful than (x.sum() ->
> bool) since x.any() already exists.
>
The question is consistency. A programmer should just have to remember a few
simple rules, not a host of special cases. It makes things easier to learn
and the code easier to understand because the intent is always made clear.
Designing to whatever happens to be convenient at the moment leads to a mess
and trying to document all the oddities is a PITA.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080524/2a9aefc3/attachment.html
More information about the Numpy-discussion
mailing list