[Python-Dev] PEP 3118: Extended buffer protocol (new version)
Greg Ewing
greg.ewing at canterbury.ac.nz
Sat Apr 14 03:41:11 CEST 2007
Travis Oliphant wrote:
> Py_BUF_SIMPLE --- you are requesting the simplest possible (0x00)
>
> Py_BUF_WRITEABLE -- get a writeable buffer (0x01)
>
> Py_BUF_READONLY -- get a read-only buffer (0x02)
I don't see how these three form a progression.
From the other things you say, it appears you mean
Py_BUF_SIMPLE to mean both readable and writeable.
But then Py_BUF_READONLY is turning off a capability
(being able to write to the buffer) rather than
turning one on.
Seems to me the "simplest possible" buffer is a
read-only one (assuming we don't want to allow for
write-only buffers -- or do we?), in which case
a more logical arrangement to my mind would be
Py_BUF_READONLY = 0x00 # simplest possible
PY_BUF_READWRITE = 0x01
If we do want write-only buffers, then there
isn't a single simplest possible buffer, except
for one that's neither readable nor writable,
which doesn't seem very useful. So we would
have
Py_BUF_READABLE = 0x01
Py_BUF_WRITABLE = 0x02
Py_BUF_READWRITE = 0x03
--
Greg
More information about the Python-Dev
mailing list