[Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering

Sebastian Berg sebastian@sipsolutions....
Thu Apr 4 15:53:41 CDT 2013


On Thu, 2013-04-04 at 12:40 -0700, Matthew Brett wrote:
> Hi,
> 
<snip>
> 
> So - to restate in other words - this :
> 
> np.reshape(a, (3, 4), order='F')
> 
> could reasonably mean one of two orthogonal things
> 
> 1) Retrieve data from the array using first-to-last indexing, return
> any memory layout you like
> 2) Retrieve data from the array using the default last-to-first index
> ordering, and return memory in F-contiguous layout
> 

Yes, it could mean both. I am simply not sure if it helps enough to
warrant the trouble. So if it still interests someone, I feel the docs
are more important, but I am neutral to changing this.
I don't quite see a big gain, so I am just worried that it bugs a lot of
people either because of changing or because of having to remember the
different name (you can argue that is good, but if it bugs most maybe it
does not help either).

As to being confused. Did anyone ever see a np.reshape(arr, ...,
order='F') and then continuing assuming the result is F-contiguous (when
the original arr is not known to be contiguous)? If that actually create
a real bug somewhere, that might actually convince me that it is worth
it to walk through trouble and complaints. I guess I just don't believe
it really happens in the real world.

- Sebastian

> Cheers,
> 
> Matthew
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 




More information about the NumPy-Discussion mailing list