[Python-Dev] Extended Buffer Protocol - simple use examples (original) (raw)
Paul Moore p.f.moore at gmail.com
Mon Apr 9 12:25:15 CEST 2007
- Previous message: [Python-Dev] Weekly Python Patch/Bug Summary
- Next message: [Python-Dev] Extended Buffer Protocol - simple use examples
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, I'll admit right off that I haven't followed all of the extended buffer protocol discussions - I have no real need for anything much beyond the existing "here's a blob of memory" level of functionality.
I have skimmed (briefly, I'll admit!) the pre-PEP, but I've found it extremely difficult to find a simple example of the basic (in my view) use case of an undifferentiated block of bytes.
Can I suggest that the following uses would be the significant majority of buffer protocol uses - they are certainly going to be the basic transitional case from the existing protocol - and deserve to be singled out in the PEP with some description or (better) pseudo-code examples. If they are already there, I apologise, but I did look, and got bogged down in the more sophisticated stuff - so they probably need making more visible.
(Producer) I have a block of memory in my C extension and I want to expose it as a simple contiguous block of bytes to Python.
(Consumer) I want to get at a block of memory exposed as a buffer. I am only interested in, and only support, viewing a buffer as a block of contiguous bytes. I expect most if not all extensions to be able to provide such a view.
I'd hope these 2 cases are pretty simple to code, but I'd like to see that made explicit in the PEP.
unsophisticated-ly y'rs Paul.
- Previous message: [Python-Dev] Weekly Python Patch/Bug Summary
- Next message: [Python-Dev] Extended Buffer Protocol - simple use examples
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]