Re: [Numpy-discussion] Counting array elements
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
Tim Hochberg wrote:
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,
Well, sometimes. :-)
SciPy uses axis=-1
I should note that this convention is for Scipy-defined functions. With one unfortunate exception (cumsum), Scipy does not overwrite Numeric's axis default for Numeric-defined functions. -- Robert Kern rkern@ucsd.edu "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter
participants (2)
-
Robert Kern
-
Tim Hochberg