[SciPy-dev] Re: [SciPy-user] scipy choice of defaults for matrix manipulation

Robert Kern rkern at ucsd.edu
Wed Aug 4 18:07:25 EDT 2004


Alan G Isaac wrote:

> The SciPy documentation says:
>         To begin with, all of the Numeric functions have
>         been subsumed into the scipy namespace so that all
>         of those functions are available without
>         additionally importing Numeric.
> 
> It was therefore unsettling to find that SciPy's function_base defines
> def cumsum(m,axis=-1):
>     """Returns the cumulative sum of the elements along the given axis
>     """
>     if axis is None:
>         m = ravel(m)
>         axis = 0
>     else:
>         m = _asarray1d(m)
>     return add.accumulate(m,axis)
> 
> This changes the default axis of Numeric and numarray.
> Bug or feature??

Implementation feature; documentation bug. Numeric's functions have 
various, inconsistent ("schizophrenic" as you say) choices for the 
default axis. An attempt, albeit incomplete as you note, was made with 
SciPy to standardize on always using axis=-1. I'm fairly positive this 
was documented somewhere at some point, but probably only on the old 
website. The tutorial really should be updated to prominently note this 
convention.

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the SciPy-Dev mailing list