[NumPy-Tickets] [NumPy] #2067: when x is an N-D array, list(x) produces surprising results

Phillip Feldman phillip.m.feldman@gmail....
Mon Feb 27 19:15:39 CST 2012


I'd appreciate a pointer to something in the NumPy reference material
that states that a N-dim ndarray is treated as a collection of
(N-1)-dim ndarrays for purposes of iteration.

Phillip

On Mon, Feb 27, 2012 at 11:45 AM,  <numpy-tickets@scipy.org> wrote:
> #2067: when x is an N-D array, list(x) produces surprising results
> ------------------------+---------------------------------------------------
>  Reporter:  pfeldman    |       Owner:  somebody
>     Type:  defect      |      Status:  new
>  Priority:  normal      |   Milestone:  Unscheduled
> Component:  numpy.core  |     Version:  1.6.1
>  Keywords:              |
> ------------------------+---------------------------------------------------
>
> Comment(by pv):
>
>  The behavior does make sense, and it is what would naturally be expected.
>  From the point of view of iteration, a N-dim ndarray *is* a collection of
>  (N-1)-dim sub-arrays. The list constructor merely retains the consistency
>  between `list(a)[j]` and `list(a[j])`. I don't see any reason to change
>  this behavior, as raveling is a separate operation.
>
> --
> Ticket URL: <http://projects.scipy.org/numpy/ticket/2067#comment:2>
> NumPy <http://projects.scipy.org/numpy>
> My example project


More information about the NumPy-Tickets mailing list