[Numpy-discussion] Raveling, reshape order keyword unnecessarily confuses index and memory ordering
matthew.brett at gmail.com
Thu Apr 4 17:04:20 EDT 2013
On Thu, Apr 4, 2013 at 1:53 PM, Sebastian Berg
<sebastian at sipsolutions.net> wrote:
> On Thu, 2013-04-04 at 12:40 -0700, Matthew Brett wrote:
>> 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 think the docs enter the discussion, because we all agree that
changing the docs is a good idea.
> 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.
There are two aspects here;
1) Making numpy easier to understand and teach.
2) Avoiding bugs
I'm thinking primarily of the first. I would hate to teach the thing
in the current state. As I've said many times before, I found it
very confusing, others have said so too. The more confusing it is,
the more likely people will make mistakes.
More information about the NumPy-Discussion