[Python-Dev] Extended Buffer Protocol - simple use examples
p.f.moore at gmail.com
Tue Apr 10 11:28:20 CEST 2007
On 09/04/07, Travis Oliphant <oliphant.travis at ieee.org> wrote:
> > 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.
> This is a great suggestion and it was on my to-do list. I've included
> some examples of this use-case in the new PEP.
Nice - those look clear to me. One question - if a producer is
generating a more complex data format (for example, the RGBA example
in the PEP) then would the "simple consumer" code (Ex. 3) still get a
pointer (or would the RGBA code need to go through extra effort to
allow this)? Sorry, again this is probably clear from reading the PEP
details, but my eyes glaze over when I read about strides, shapes,
My motivation here is that it would be a shame if "old-style" code
that was prepared to guess the format of a memory block stopped
working when the producer of the memory added shape information (that
the consumer didn't care about, except to validate its guess).
More information about the Python-Dev