Buffer objects

Terry Reedy tjreedy at udel.edu
Mon Sep 1 15:31:41 EDT 2008



Tom Harris wrote:
> Greetings,
> 
> I need a little help with buffer objects. Many Python objects export
> the buffer interface, or can be persuaded to create a buffer object
> with a buffer() call.
...
> It must be me but I have found the whole buffer thing difficult to
> understand from the docs, it appears only useful to C coders, but I
> use the buffer interface (GetData()) of wx.Image objects a lot in my
> work.

The 1.x/2.x buffer interface was not considered terribly successful.
Buffer() is gone in 3.0.  I believe class memoryview() (which supports 
viewing the 'buffer' as an n-dimensional array) is considered to be its 
replacement.  You might find the latter in 2.6 also.

Images, in particular, will be viewed as row x column x color, or color 
x row x column, or whatever, as defined by the attributes of the memory 
view object in a standardized format.




More information about the Python-list mailing list