Buffers and pointers (Py3.4)

Chris Angelico rosuav at gmail.com
Mon Apr 17 14:47:22 EDT 2017

On Tue, Apr 18, 2017 at 3:58 AM, Rob Gaddi
<rgaddi at highlandtechnology.invalid> wrote:
> If I were writing this as a C extension, getting that information from any
> buffer object would be trivial, but that changes my project from a pure
> Python wrapper using ctypes to a mixed language project with compile
> dependencies and mental headaches.
>   buffertype = c_uint8 * size
>   return addressof(buffertype.from_buffer(buf, offset))
> works but is inefficient and woefully inelegant.

Have you considered Cython? It can massively simplify a lot of the
work in doing this kind of thing.


More information about the Python-list mailing list