efficiently create and fill array.array from C code?

Stephen Hansen me+list/python at ixokai.io
Sun Jun 13 13:28:56 EDT 2010


On 6/13/10 10:15 AM, Thomas Jollans wrote:
> Hi,
> 
> I'm writing some buffer-centric number-crunching routines in C for
> Python code that uses array.array objects for storing/manipulating data.
> I would like to:


Take this with a grain of salt: I am *not* a C programmer, and my usage
of the Python/C API is extremely minimal.

However, I think you're looking for The Buffer Interface. Its, IIUC, the
way to read/write efficiently into existing data structures without
having to go all Pythony.

It changed in Py3k: http://www.python.org/dev/peps/pep-3118/

Again: I may be entirely wrong. Not my area of expertise. But I lurk a lot.

-- 

   Stephen Hansen
   ... Also: Ixokai
   ... Mail: me+list/python (AT) ixokai (DOT) io
   ... Blog: http://meh.ixokai.io/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20100613/17b10ade/attachment-0001.sig>


More information about the Python-list mailing list