A better python interface for buffer objects
Paul Barrett
barrett at stsci.edu
Mon Dec 4 16:50:01 EST 2000
I've just started working with buffer objects and noticed that they do
not appear to be well supported at the python level, particularly for
writeable buffer objects which I need. The string object exports a
buffer interface, but only for read-only access. (Though if you test for
the bf_getwritebuffer slot, it appears to be defined, indicating the
string method is writeable. Only when you invoke this function does it
return an error indicating that it's a read-only buffer. Is there a
reason for implementing it this way, since I find this rather
confusing?) Since I can't use a string object as a writeable buffer, is
there some other object that I can use as a writeable buffer, not
include that mmap object? What I'd like to do is just create a writeable
buffer directly indicating the desired amount of memory, for example
>>> buff = buffer(1024, 'w')
I'm willing to supply patches to Python to support his type of
functionality, if it can be agreed upon.
-- Paul
--
Dr. Paul Barrett Space Telescope Science Institute
Phone: 410-338-4475 ESS/Science Software Group
FAX: 410-338-4767 Baltimore, MD 21218
More information about the Python-list
mailing list