[Python-Dev] Deprecate the buffer object?

Alex Martelli aleaxit at yahoo.com
Tue Oct 28 17:23:18 EST 2003


On Tuesday 28 October 2003 11:09 pm, Neil Schemenauer wrote:
> I happened to be looking at the buffer API today and I came across
> this posting from Guido:
>
>   http://mail.python.org/pipermail/python-dev/2000-October/009974.html
>
> Over the years there has been a lot of discussion about the buffer
> API and the buffer object.  The general consensus seems to be that
> the buffer API is not ideal but nonetheless useful.  The buffer
> object, OTOH, is considered fundamentally broken and should be
> removed.
>
> Does anyone object to deprecating the 'buffer' builtin?  Eventually
> we could remove the buffer object completely.

Is that about RW buffers specifically?  Because I _have_ used R/O
buffers in production code -- when I had a huge string already in
memory, and needed various largish substrings of it at different
but overlapping times, without paying the overhead to copy them
as slicing would have done.  Having 'buffer' as a buit-in was quite
minor though -- considering the number of times I have used it,
importing some module to get at it would have been perfectly
acceptable, perhaps preferable.  If the buffer interface stays but
the function completely disappears, I guess it won't be too hard
for me to recreate it in a tiny extension module, but it's not quite
clear to me why I should need to.

R/W buffers I've never used in production, though.  I do recall
once (at the very beginning of my Python usage) using an 
array's buffer_info method as a Q&D way to do some interfacing
to C, but that was before ctypes, which I think is what i'd use now.


Alex




More information about the Python-Dev mailing list