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

josef.pktd@gmai... josef.pktd@gmai...
Sat Mar 30 18:50:53 CDT 2013


On Sat, Mar 30, 2013 at 7:31 PM, Bradley M. Froehle
<brad.froehle@gmail.com> wrote:
> On Sat, Mar 30, 2013 at 3:21 PM, Matthew Brett <matthew.brett@gmail.com>
> wrote:
>>
>> On Sat, Mar 30, 2013 at 2:20 PM,  <josef.pktd@gmail.com> wrote:
>> > On Sat, Mar 30, 2013 at 4:57 PM,  <josef.pktd@gmail.com> wrote:
>> >> On Sat, Mar 30, 2013 at 3:51 PM, Matthew Brett
>> >> <matthew.brett@gmail.com> wrote:
>> >>> On Sat, Mar 30, 2013 at 4:14 AM,  <josef.pktd@gmail.com> wrote:
>> >>>> On Fri, Mar 29, 2013 at 10:08 PM, Matthew Brett
>> >>>> <matthew.brett@gmail.com> wrote:
>> >>>>>
>> >>>>> Ravel and reshape use the tems 'C' and 'F" in the sense of index
>> >>>>> ordering.
>> >>>>>
>> >>>>> This is very confusing.  We think the index ordering and memory
>> >>>>> ordering ideas need to be separated, and specifically, we should
>> >>>>> avoid
>> >>>>> using "C" and "F" to refer to index ordering.
>> >>>>>
>> >>>>> Proposal
>> >>>>> -------------
>> >>>>>
>> >>>>> * Deprecate the use of "C" and "F" meaning backwards and forwards
>> >>>>> index ordering for ravel, reshape
>> >>>>> * Prefer "Z" and "N", being graphical representations of unraveling
>> >>>>> in
>> >>>>> 2 dimensions, axis1 first and axis0 first respectively (excellent
>> >>>>> naming idea by Paul Ivanov)
>> >>>>>
>> >>>>> What do y'all think?
>> >>>>
>> >>>> I always thought "F" and "C" are easy to understand, I always thought
>> >>>> about
>> >>>> the content and never about the memory when using it.
>> >>
>> >> changing the names doesn't make it easier to understand.
>> >> I think the confusion is because the new A and K refer to existing
>> >> memory
>> >>
>>
>> I disagree, I think it's confusing, but I have evidence, and that is
>> that four out of four of us tested ourselves and got it wrong.
>>
>> Perhaps we are particularly dumb or poorly informed, but I think it's
>> rash to assert there is no problem here.

I think you are overcomplicating things or phrased it as a "trick question"

ravel F and C have *nothing* to do with memory layout.
I think it's not confusing for beginners that have no idea and never think
about memory layout.
I've never seen any problems with it in statsmodels and I have seen
many developers (GSOC) that are pretty new to python and numpy.
(I didn't check the repo history to verify, so IIRC)

Even if N, Z were clearer in this case (which I don't think it is and which
I have no idea what it should stand for), you would have to go for every
use of ``order`` in numpy to check whether it should be N or F or Z or C,
and then users would have to check which order name convention is
used in a specific function.

Josef

>
>
> I got all four correct.  I think the concept --- at least for ravel --- is
> pretty simple: would you like to read the data off in C ordering or Fortran
> ordering.  Since the output array is one-dimensional, its ordering is
> irrelevant.
>
> I don't understand the 'Z' / 'N' suggestion at all.  Are they part of some
> pneumonic?
>
> I'd STRONGLY advise against deprecating the 'F' and 'C' options.  NumPy
> already suffers from too much bikeshedding with names --- I rarely am able
> to pull out a script I wrote using NumPy even a few years ago and have it
> immediately work.
>
> Cheers,
> Brad
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the NumPy-Discussion mailing list