[Python-Dev] pre-PEP: The Safe Buffer Interface

Guido van Rossum guido@python.org
Wed, 31 Jul 2002 11:37:07 -0400


> I think Neil put forth the names "acquire" and "release".  So how about
> 
>         typedef struct {
>                 getreadbufferproc bf_getreadbuffer;
>                 getwritebufferproc bf_getwritebuffer;
>                 getsegcountproc bf_getsegcount;
>                 getcharbufferproc bf_getcharbuffer;
>                 /* fixed buffer interface functions */
>                 acquirereadbufferproc bf_acquirereadbuffer;
>                 acquirewritebufferproc bf_acquirewritebuffer;
>                 releasebufferproc bf_releasebuffer;
>         } PyBufferProcs;
> 
> Whatever the actual names, should there be a bf_releasereadbuffer and
> bf_releasewritebuffer?  Or just the one bf_releasebuffer?

Just the one.

> Could also just have one acquire function that indicates whether it
> is read-write or read-only via a return parameter.

That loses the (weak) symmetry with the existing API.

> Is write-only ever useful?

No, write implies read.

--Guido van Rossum (home page: http://www.python.org/~guido/)