Neal Becker wrote:
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.
The simple data-buffer interpretation is still there. You can still use simple "chunk-of-memory" only interpretation of the buffer. All we are doing is adding a way for applications to ask if the object can be interpreted as a strided N-dimensional array of a particular data-format. So, this proposal does nothing to jeopardize the buffer-as-an-interface-to-memory only model. I'm only using a table of funciton pointers which is already there (tp_as_buffer) rather than request an additional table of function pointers on the type object (tp_as_array). I see the array view idea as fitting very nicely with the buffer protocol. -Travis