[Python-Dev] buffer interface considered harmful

Fredrik Lundh fredrik@pythonware.com
Mon, 16 Aug 1999 09:06:43 +0200


> I think the buffer interface was introduced in 1.5 (by Jack?). I added
> the 8-bit character buffer slot and buffer objects in 1.5.2.
> 
> > from array import array
> > 
> > a = array("f", [0]*8192)
> > 
> > b = buffer(a)
> > 
> > for i in range(1000):
> >     a.append(1234)
> > 
> > print b
> > 
> > in other words, the buffer interface should
> > be redesigned, or removed.
> 
> I don't understand what you believe is weird here.

did you run that code?

it may work, it may bomb, or it may generate bogus
output. all depending on your memory allocator, the
phase of the moon, etc. just like back in the C/C++
days...

imo, that's not good enough for a core feature.

</F>