[Numpy-discussion] Proposal of new function: iteraxis()
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 <email@example.com> wrote:
> On Thu, Apr 25, 2013 at 6:54 PM, Matthew Brett <firstname.lastname@example.org>
> > Hi,
> > On Thu, Apr 25, 2013 at 10:42 AM, Robert Kern <email@example.com>
> >> On Thu, Apr 25, 2013 at 6:30 PM, Matthew Brett <firstname.lastname@example.org>
> >>> 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
Andrew Giessel, PhD
Department of Neurobiology, Harvard Medical School
220 Longwood Ave Boston, MA 02115
ph: 617.432.7971 email: email@example.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion