[Python-3000] PEP Draft: Enhancing the buffer protcol

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 1 00:57:05 CET 2007


Travis E. Oliphant wrote:

> Yes, this was the reason for my dtype object.  But, I think that folks 
> felt it was too much, especially since the struct-style syntax is 
> already there in Python.

Making it a full-blown Python object would be too much
for this application. But it could be something like an
array of structs containing a type code and a size.

> Besides not allowing for the request of a "contiguous" buffer

Add an argument as appropriate.

> you are also not describing how allocation for
> this array of structs will be handled.

That's up to the base object. Something with a fixed
number of dimensions (as I expect most objects implementing
this protocol will) can store it in the object itself.
If the number of dimensions can vary, it might have to
malloc/realloc. But that doesn't seem like a difficult
thing to do.

--
Greg


More information about the Python-3000 mailing list