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

seberino at spawar.navy.mil seberino at spawar.navy.mil
Thu Feb 5 03:06:41 EST 2004


Andrew

Thanks.  I did it and it looks like it works too.

Chris

On Wed, Feb 04, 2004 at 07:21:15PM +1100, Andrew MacIntyre wrote:
> 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
>

--
_______________________________________

Christian Seberino, Ph.D.
SPAWAR Systems Center San Diego
Code 2872
49258 Mills Street, Room 158
San Diego, CA 92152-5385
U.S.A.

Phone: (619) 553-9973
Fax  : (619) 553-6521
Email: seberino at spawar.navy.mil
_______________________________________




More information about the Python-list mailing list