[Python-3000] PEP Draft: Enhancing the buffer protcol (original) (raw)
Travis Oliphant oliphant.travis at ieee.org
Thu Mar 1 01:22:36 CET 2007
- Previous message: [Python-3000] PEP Draft: Enhancing the buffer protcol
- Next message: [Python-3000] PEP Draft: Enhancing the buffer protcol
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
Another thing going in the struct-syntax's favor is that it seems to be accepted by a wide number of Python devs. But, I'm open to anything that contains the same level of expressiveness.
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.
I see better now. The objects themselves would store the dimensions (either directly as part of the object), or in some extension-module-maintained memory (that is used as a buffer to copy into everytime it is needed).
That is fine by me. I suppose the format-string could be managed the same way --- it's up to the type object implementing the interface to manage it.
-Travis
- Previous message: [Python-3000] PEP Draft: Enhancing the buffer protcol
- Next message: [Python-3000] PEP Draft: Enhancing the buffer protcol
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]