A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2007-April/072535.html below:

[Python-Dev] Extended Buffer Protocol - simple use examples

[Python-Dev] Extended Buffer Protocol - simple use examplesPaul Moore p.f.moore at gmail.com
Mon Apr 9 12:25:15 CEST 2007
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.

1. (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.

2. (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.
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4