Re: Buffers and pointers (Py3.4)

2017-04-18 Thread Rob Gaddi
On 04/17/2017 11:47 AM, Chris Angelico wrote: On Tue, Apr 18, 2017 at 3:58 AM, Rob Gaddi 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

Re: Buffers and pointers (Py3.4)

2017-04-18 Thread Neal Becker
When I worked on talking to some hardware in the past, the hardware was directly mapped to memory, and then numpy mmap worked great. Maybe not the same hardware interface you have. Rob Gaddi wrote: > So long as we're all feeling so concerned about speed lately... > > I've got a piece of

Re: Buffers and pointers (Py3.4)

2017-04-17 Thread Rob Gaddi
On 04/17/2017 02:49 PM, eryk sun wrote: On Mon, Apr 17, 2017 at 5:58 PM, Rob Gaddi wrote: buffertype = c_uint8 * size return addressof(buffertype.from_buffer(buf, offset)) works but is inefficient and woefully inelegant. A lot of the cost there is in

Re: Buffers and pointers (Py3.4)

2017-04-17 Thread eryk sun
On Mon, Apr 17, 2017 at 5:58 PM, Rob Gaddi wrote: > buffertype = c_uint8 * size > return addressof(buffertype.from_buffer(buf, offset)) > > works but is inefficient and woefully inelegant. A lot of the cost there is in creating buffertype, but why do you need

Re: Buffers and pointers (Py3.4)

2017-04-17 Thread Chris Angelico
On Tue, Apr 18, 2017 at 3:58 AM, Rob Gaddi 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

Buffers and pointers (Py3.4)

2017-04-17 Thread Rob Gaddi
So long as we're all feeling so concerned about speed lately... I've got a piece of hardware that allows me to call a C library that calls an ioctl() that kicks off a DMA transfer and moves data between process memory and external hardware. I would like a way to turn an arbitrary object