in c extension what is easiest way to build a (PyObject) list from an array of doubles?

Andrew MacIntyre andymac at bullseye.apana.org.au
Wed Feb 4 03:21:15 EST 2004


On Tue, 3 Feb 2004 seberino at spawar.navy.mil wrote:

> How do you build a list/tuple/array/ from a C array of numbers?

The API docs are what you need to look at.

To create a tuple, call PyTuple_New().

For each element in your C array, build a Python object then use
PyTuple_SetItem() to insert it into the tuple.

--
Andrew I MacIntyre                     "These thoughts are mine alone..."
E-mail: andymac at bullseye.apana.org.au  (pref) | Snail: PO Box 370
        andymac at pcug.org.au             (alt) |        Belconnen  ACT  2616
Web:    http://www.andymac.org/               |        Australia




More information about the Python-list mailing list