[Numpy-discussion] Counting array elements
Tim Hochberg
tim.hochberg at cox.net
Sun Oct 31 14:24:01 CST 2004
Robert Kern wrote:
> Tim Hochberg wrote:
>
>> Could you describe the SciPy axis convention: I'm not familiar with it.
>
>
> axis=-1
OK, so Numarray (currently) and Numeric use axis=0, SciPy uses axis=-1
and there is some desire to use axis=ALL as instead.
One advantage of ALL is that it breaks everyone's code equally, so there
wouldn't be any charges of favoritism <0.8 wink>.
I can't come up with any way to reconcile the three, but I can suggest a
transition strategy whatever the decision. Supply an option so that one
can require axis arguments to all calls to reduce. Then it's relatively
easy to track down all the reduce calls and fix the ones that are
broken. Something like numarray.setRequireReduceAxisArg(True).
FWIW, it wouldn't bother me much to use SciPy's default here: supporting
SciPy is a worthwhile goal and I think SciPy's choice here is a
reasonable one. Another alternative that wouldn't bother me much is "In
the face of ambiguity, refuse the temptation to guess". That is, always
require axis arguments for multidimensional arrays. While not backwards
compatible, this would make the transition relatively easy, since uses
that might fail would raise exceptions.
-tim
More information about the Numpy-discussion
mailing list