Nick Coghlan wrote:

The multi-dimensional cases get pretty tricky though, since they will
almost always end up dealing with non-contiguous data. The PEP 3118
protocol is up to handling the task, but the implementation of the index
mapping to handle these multi-dimensional cases is highly non-trivial,
and probably best left to third party libraries like numpy.

I'm wondering whether there should be some kind of utility
function provided with the buffer API for doing this. It
would take the shape/strides info from a Py_buffer together
with a set of slicing parameters, and create you another
set of shape/strides info describing the slice.

It seems sensible to put the effort into doing this
correctly once, rather than leave everyone implementing
a memoryview-like object to come up with their own
half-working and/or broken implementation.

--
Greg
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to