[Python-3000] pre-PEP: Enhancing buffer protocol (tp_as_buffer)

Guido van Rossum guido at python.org
Tue Feb 27 01:16:28 CET 2007


On 2/26/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Travis Oliphant wrote:
>
> > If they can't do it easily, then they don't have to define the
> > release-function and Python will never call it.
>
> The case I'm worried about is where the data can move,
> so it really *needs* to be locked, yet the object has
> no way of ensuring that. It would be impossible for
> the object to correctly implement this kind of buffer
> protocol.

Are you aware of an object that has such a requirement? I would think
that the object is in charge of moving its own buffer. If it doesn't
have control over when the buffer moves it shouldn't claim to
implement the buffer protocol.

> > If you want shape information you are going to have to allocate memory.
>
> But only when the shape changes, not every time you
> want a pointer to the memory.
>
> I like Guido's idea of separating the shape/type info
> from getting the memory pointer.

Well it's not my area of expertise. I thought that in order to
describe a generalized 3d slice of a 3d array you might need offsets
for at least some of the dimensions, but I could be wrong.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list