[Numpy-discussion] ufunc oddities
Charles R Harris
Sat May 24 22:40:18 CDT 2008
On Sat, May 24, 2008 at 9:35 PM, Nathan Bell <email@example.com> wrote:
> On Sat, May 24, 2008 at 10:24 PM, Charles R Harris
> <firstname.lastname@example.org> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion