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

Andrew Giessel andrew_giessel@hms.harvard....
Fri Apr 26 06:26:01 CDT 2013


I agree with Charles that rollaxis() isn't immediately intuitive.

It seems to me that documentation like this doesn't belong in rollaxis()
but instead wherever people talk about indexing and/or iterating over an
array.  Nothing about the iteration depends on rollaxis(),  rollaxis is
just giving you a different view of the array to call __getitem__() on, if
I understand correctly.

I'm counting 2 for (Me, Charles), 2 against (Robert, Josef), and two or
three neutral parties (based on interest/comments: Matthew, Sebastian, and
Phil Elson (who commented on the PR)).  I don't know how to best proceed
from here.

Best,

Andrew


On Fri, Apr 26, 2013 at 5:42 AM, Robert Kern <robert.kern@gmail.com> wrote:

> On Thu, Apr 25, 2013 at 9:04 PM, Charles R Harris
> <charlesr.harris@gmail.com> wrote:
>
> > After thinking about it, I'm in favor of this small function. Rollaxis
> takes
> > a bit of thought and document reading to figure out how to use it,
> whereas
> > this function covers a common use with an easy to understand API.
>
> It seems to me that just an additional example in the rollaxis()
> docstring solves that problem:
>
>   ``rollaxis()`` can be used to iterate over a given axis of a
> multidimensional array:
>
>     >>> for x in np.rollaxis(a, 2):
>     ...     print x.shape
>     ...
>     (3, 4, 6)
>     (3, 4, 6)
>     (3, 4, 6)
>     (3, 4, 6)
>     (3, 4, 6)
>
> --
> 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/20130426/aa48d7c4/attachment.html 


More information about the NumPy-Discussion mailing list