[Python-Dev] Error in PEP3118?

Travis Oliphant oliphant.travis at ieee.org
Tue Feb 19 18:10:31 CET 2008


Lisandro Dalcin wrote:
> On 2/11/08, Travis Oliphant <oliphant.travis at ieee.org> wrote:
>> My perception is that you are seeing too much of a connection between
>> the C-compiler and the PEP description of memory.   Perhaps that's not
>> it, and I'm missing something else.
>>
> 
> Travis, all this make me believe that (perhaps) the 'format'
> specification in the new buffer interface is missing the 'C' or 'F'
> ordering in the case of a countiguos block. I'm missing something? Or
> should we always assume a 'C' ordering?

There is an ability to specify 'F' for the overall buffer.   In the 
description of each element, however, (i.e. in the struct-syntax), the 
multi-dimensional character is always communicated in 'C' order 
(last-dimension varies the fastest).

I thought about adding the ability to specify the multi-dimensional 
order as 'F' in the struct-syntax for each element, but felt against it 
as you can simulate 'F' order by thinking of the array in transpose 
fashion:  i.e.  your 3x5 Fortran-order array is really a 5x3 (C-order 
array).

Of course, the same is true on the larger scale when we are talking 
about multi-dimensional arrays of "elements," but on that level 
connecting with Fortran libraries is much more common and so we have 
found the help useful in NumPy.

-Travis O.



More information about the Python-Dev mailing list