[Python-Dev] Allocation of shape and strides fields in Py_buffer

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 Py_buffer and one set of shape/strides
> at a time. Slicing the memoryview creates another
> memoryview with its own Py_buffer 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