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

Matthew Brett matthew.brett@gmail....
Thu Apr 4 13:48:40 CDT 2013


Hi,

On Thu, Apr 4, 2013 at 9:21 AM, Chris Barker - NOAA Federal
<chris.barker@noaa.gov> wrote:
> On Wed, Apr 3, 2013 at 6:13 PM, Matthew Brett <matthew.brett@gmail.com> wrote:
>>> We all agree that 'order' is used with two different and orthogonal
>>> meanings in numpy.
>
> well, not entirely orthogonal -- they are the some concept, used in
> different contexts, so there is some benefit to their having
> similarity. So I"d advocate for using the same flag names in any case
> -- i.e. "C" and "F" in both cases.
>
>>> I think we are now more or less agreeing that:
>>>
>>> np.reshape(a, (3, 4), index_order='F')
>>>
>>> is at least as clear as:
>>>
>>> np.reshape(a, (3, 4), order='F')
>
> sure.
>
> The trick is:
>
> np.reshape(a, (3, 4), index_order='A')
>
> which in mingling index_order and memory order......
>
>> I believe our job here is to come to some consensus.
>
> yup.
>
>> In that spirit, I think we do agree on these statements above.
>
> with the caveats I just added...
>
>> Now we have the cost / benefit.
>>
>> Benefit : Some people may find it easier to understand numpy when
>> these constructs are separated.
>>
>> Cost : There might be some confusion because we have changed the
>> default keywords.
>>
>> Benefit
>> -----------
>>
>> What proportion of people would find it easier to understand with the
>> order constructs separated?
>
> It's not just numbers -- it's depth of confusion -- if, once you "get"
> it, you remember it for the rest of your numpy use, then it's not big
> deal. However, if you need to re-think and test every time you
> re-visit reshape or ravel, then there's a significant benefit.
>
> We are talking about "separating the concepts", but I think it takes
> more than a keyword change to do that -- the 'A' and 'K' flags mingle
> the concpets, and are going to be confusing with new keywords -- maybe
> even more so (it says index_order, but the docstring talks about
> memory order)
>
> Does anyone think we should depreciate the 'A' and 'K' flags?

Would you consider moving this one to another thread?

Cheers,

Matthew


More information about the NumPy-Discussion mailing list