Russell Warren wrote:
> How can you tell what objects support the buffer interface? Is
> anything visible at the python level, or do you need to dig into the C
> source?
At the C level, there is a function for testing:
int PyObject_CheckReadBuffer(PyObject* o)
http://docs.python.org/dev/api/abs
After some digging around it appears there is not a tonne of
documentation on buffer objects, although they are clearly core and
ancient... been sifting through some hits circa 1999, long before my
python introduction.
What I can find says that buffer is deprecated (Python in a Nutshell),
or non-e
> Many functions that operate on strings also accept buffer objects as
> parameters,
> this seems also be the case for the base64.encodestring function. ctypes
> objects
> support the buffer interface.
>
> So, base64.b64encode(buffer(ctypes_instance)) should work efficiently.
Thanks! I have ne
Russell Warren schrieb:
> I've got a case where I want to convert binary blocks of data (various
> ctypes objects) to base64 strings.
>
> The conversion calls in the base64 module expect strings as input, so
> right now I'm converting the binary blocks to strings first, then
> converting the resul
I've got a case where I want to convert binary blocks of data (various
ctypes objects) to base64 strings.
The conversion calls in the base64 module expect strings as input, so
right now I'm converting the binary blocks to strings first, then
converting the resulting string to base64. This seems h