[Python-3000] pre-PEP: Enhancing buffer protocol (tp_as_buffer)
Guido van Rossum
guido at python.org
Mon Feb 26 22:12:47 CET 2007
On 2/26/07, Travis Oliphant <oliphant.travis at ieee.org> wrote:
> One more question? What is the reason for separate read/write getbuffer
> calls. What is the problem with just one getbuffer call with a flag to
> indicate whether or not you want a writeable memory area?
I'm not sure; that API grew somewhat organically. I guess having
separate functions makes it possible to test whether the buffer is
writable at all, but IMO checking for an error is just as expedient,
so as long as we're redesigning the whole API you can design whatever
> I prefer fewer function pointers because it means that extension types
> must implement fewer functions. But, either way.
> I know there is some stylistic distaste for "flags" in APIs.
That's more a Python-level preference.
> One could still keep two C-API calls for getting read-only and writeable buffers.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000