Proper application of the buffer interface
Fred L. Drake, Jr.
fdrake at acm.org
Thu Aug 5 04:30:14 CEST 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
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!)
Fred L. Drake, Jr. <fdrake at acm.org>
Corporation for National Research Initiatives
More information about the Python-list