Proper application of the buffer interface

Fred L. Drake, Jr. fdrake at acm.org
Wed Aug 4 22:30:14 EDT 1999


  There has been a bit of discussion lately regarding the buffer
interface to objects in the C API.  Some of this has been on the main
list (comp.lang.python) and some has been on other Python-related
lists.
  I have a question that I don't recall seeing answered (or asked):
What is the real intent of the buffer interface?  When should a Python 
C type implement it?
  The context is this:  the t1python package (an interface to a Type1
font renderer) has, in the past, been passing bitmaps back to Python
as string objects.  In the next release, I may create a new type in
the C layer that provides all the interesting stuff, and would like to 
be able to convert these "glyph" objects to PIL images and GTK+/GNOME
compatible images.  Does it make the most sense for the glyph objects
to offer the buffer interface to make more conversions possible
without increasing the number of memory copies, or do I misunderstand
the application of the interface?
  I'd appreciate some input on this matter.  I hope to get the next
release of t1python done before too much longer, and this is probably
the biggest remaining question that I need to deal with.
  (Any other feedback on t1python would be useful as well!)
  Thanks!


  -Fred

--
Fred L. Drake, Jr.	     <fdrake at acm.org>
Corporation for National Research Initiatives




More information about the Python-list mailing list