[Python-Dev] Allocation of shape and strides fields in Py_buffer (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Wed Dec 10 12:54:01 CET 2008


Greg Ewing wrote:

In any case, I think it should be possible to implement either version without the memoryview having to own more than one Pybuffer and one set of shape/strides at a time. Slicing the memoryview creates another memoryview with its own Pybuffer and shape/strides.

The important point is that the shape information in the Py_buffer filled in by the underlying object is the shape of that object.

Except in the trivial case where the memoryview is exposing the entire underlying data buffer, the shape information in the Py_buffer has nothing to do with the shape of the memoryview object itself.

Cheers, Nick.

-- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia



More information about the Python-Dev mailing list