[Numpy-discussion] Proposal of new function: iteraxis()

Andrew Giessel andrew_giessel@hms.harvard....
Thu Apr 25 14:21:19 CDT 2013

I respect this opinion.  However (and maybe this is legacy), while reading
through the numeric.py source file, I was surprised at how short many of
the functions are, generally.  Functions like ones() and zeros() are pretty
simple wrappers which call empty() and then copy over values.

FWIW, I had used numpy for over two years before realizing that the default
behavior of iterating on a numpy array was to return slices over the first
axis (although, this makes sense because it makes a 1d array like a list),
and I think it is generally left out of any tutorials or guides.

If nothing else I learned how to build the numpy source and how to make
tests.  And how to iterate over axes with np.rollaxis() ;)

Any other opinions from people that haven't commented on the PR thread


On Thu, Apr 25, 2013 at 3:10 PM, Robert Kern <robert.kern@gmail.com> wrote:

> On Thu, Apr 25, 2013 at 6:54 PM, Matthew Brett <matthew.brett@gmail.com>
> wrote:
> > Hi,
> >
> > On Thu, Apr 25, 2013 at 10:42 AM, Robert Kern <robert.kern@gmail.com>
> wrote:
> >> On Thu, Apr 25, 2013 at 6:30 PM, Matthew Brett <matthew.brett@gmail.com>
> wrote:
> >>> So the decision has to be based on some estimate of:
> >>>
> >>> 1) Cost for adding a new function to the namespace
> >>> 2) Benefit : some combination of: Likelihood of needing to iterate
> >>> over arbitrary axis. Likelihood of not finding rollaxis / transpose as
> >>> a solution to this. Increased likelihood of finding iteraxis in this
> >>> situation.
> >>
> >> 3) Comparison with other solutions that might obtain the same benefits
> >> without the attendant costs: i.e. additional documentation in any
> >> number of forms.
> >
> > Right, good point.  That would also need to be weighted with the
> > likelihood that people will find and read that documentation.
> In my opinion, duplicating functionality under different aliases just
> so people can supposedly find things without reading the documentation
> is not a viable strategy for building out an API.
> My suggestion is to start building out a "How do I ...?" section to
> the User's Guide that answers small questions like this. "How do I
> iterate over an arbitrary axis of an array?" should be sufficiently
> discoverable. This is precisely the kind of problem that documentation
> solves better than anything else. This is what we write documentation
> for. Let's make use of it before trying something else. If we add such
> a section, and still see many people not finding it, then we can
> consider adding aliases.
> --
> Robert Kern
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

Andrew Giessel, PhD

Department of Neurobiology, Harvard Medical School
220 Longwood Ave Boston, MA 02115
ph: 617.432.7971 email: andrew_giessel@hms.harvard.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20130425/aedb35d6/attachment-0001.html 

More information about the NumPy-Discussion mailing list