Creating arrays (builtin) in C Extensions

Duncan Booth duncan.booth at invalid.invalid
Wed Feb 28 08:00:51 EST 2007


"iwl" <Ingo.Wolf at gmx.de> wrote:

> 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



More information about the Python-list mailing list