[Python-3000] Revised PEP for buffer protocol

Josiah Carlson jcarlson at uci.edu
Tue Mar 20 18:44:58 CET 2007


"Travis E. Oliphant" <oliphant.travis at ieee.org> wrote:
>     abstractly as if it were. I believe, the PIL is where the idea of
>     multiple buffer segments in the original buffer interface came
>     from, I believe.

Remove the last "I believe" in that sentence and remove the commas. ;)

>     The buffer interface should allow discontiguous memory areas to
>     share standard striding information.  However, consumers that do
>     not want to deal with strided memory should also be able to
>     request a contiguous segment easily.

I don't believe this is necessary.  While the point of the buffer
interface is to offer direct access to memory regions of an object or
structure, being able to ask "can I get a contiguous segment" isn't
really reasonable. The response is either going to be "yes, that's how I
represent it anyways" or "no, that's not how I represent the data".  But
this bit of meta information is easily acquired by *getting* the buffer
and checking the stride.


Otherwise, everything looks fine.  I'm not convinced that function
pointers need to be part of the specification.  I can't think of a
single positive use-case, and bad data is a security breach waiting to
happpen, who has a use for this?

 - Josiah



More information about the Python-3000 mailing list