[Numpy-discussion] Latest Array-Interface PEP

Neal Becker ndbecker2 at gmail.com
Fri Jan 5 08:38:49 CST 2007


Travis Oliphant wrote:

> Neal Becker wrote:
>> Travis Oliphant wrote:
>>
>>   
>>> I'm attaching my latest extended buffer-protocol PEP that is trying to
>>> get the array interface into Python.  Basically, it is a translation of
>>> the numpy header files into something as simple as possible that can
>>> still be used to describe a complicated block of memory to another user.
>>>
>>> My purpose is to get feedback and criticisms from this community before
>>> display before the larger Python community.
>>>
>>> -Travis
>>>     
>>
>> I'm wondering if having the buffer object specify the view is the right
>> choice.  I think the best choice is to separate the design into:
>>
>> buffer: provides an interface to memory
>> array: provides a view of memory as an array of whatever dimensions
>>
>> 1. buffer may or may not map to contiguous memory.
>> 2. multiple views of the same memory can be shared.  These different
>> views could represent different slicings.
>>   
> 
> I don't understand your concerns, could you please help clarify?
> 
> I'm not doing anything with the buffer object at all.  I'm only using
> the buffer "protocol" (i.e. extending the set of function pointers
> pointed to by tp_as_buffer in the type-object).
> 
> -Travis

    Several extensions to Python utilize the buffer protocol to share
    the location of a data-buffer that is really an N-dimensional
    array.  However, there is no standard way to exchange the
    additional N-dimensional array information so that the data-buffer
    is interpreted correctly.
 
I am questioning if this is the best concept.  It says that the data-buffer
will carry the information about it's interpretation as an N-dimensional
array.

I'm thinking that a buffer is just an interface to memory, and that the
interpretation as an array of n-dimensions, for example, is best left to
the application.  I might want to at one time view the data as
n-dimensional, but at another time as 1-dimensional, for example.




More information about the Numpy-discussion mailing list