Creating arrays (builtin) in C Extensions

I

iwl

Hello,

there is an builtin documented array module in phyton,
but no documentation how such an array can be
created in C-Extension functions.
So I have to use Lists at time, but this is I think
inefficient with large data sets.

Is there some interface aviable which I can link to my
Programm without any change to standard python?
 
D

Duncan Booth

iwl said:
there is an builtin documented array module in phyton,
but no documentation how such an array can be
created in C-Extension functions.

I would guess you create an array from C the same way you create any other
Python objects. So call PyImport_ImportModule to get the array module, get
its 'array' attribute with PyObject_GetAttrString then call PyObject_New to
create your array.

There is documentation on how to set the data in the array. See
http://docs.python.org/api/bufferObjects.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top