Python's buffer interface

Randall Hopper aa8vb at yahoo.com
Fri Oct 15 11:34:44 EDT 1999


     From a commentary I read, it looks very useful.  I'd like to learn
more about the it -- in particular, how to write conforming C interfaces.

     However, I didn't find any mention of this in the docs.  Did I miss
something?  Or have the docs not caught up with it.

     Also, a bit of puzzlement after trying a brief test (adapted from a
code snippet in the list archives):

     Do buffer objects not have any methods?

     ----------------------------------------------------------------
     >>> import array
     >>> a=array.array("b", range(ord('A'), ord('G')))
     >>> print a
     array('b', [65, 66, 67, 68, 69, 70])
     >>> b = buffer(a)
     >>> print b
     ABCDEF
     >>> dir(b)
     []
     ----------------------------------------------------------------

Looks like they know how to print themselves at least (repr/str?)

Randall





More information about the Python-list mailing list