Using Py_BuildValue() to create a list of tuples in C

Viewed 6670

I am trying to use Py_BuildValue() to create a list of tuples in C.

What I am trying to build would look like this:

[ (...), (...), ... ] 

I don't know the amount of tuples to create at compilation, so I can't use some static amount here.

Essentially using Py_BuildValue() with one tuple here is what it would look like for the code:

PyObject * Py_BuildValue("[(siis)]", name, num1, num2, summary);

But that would only be for one tuple. I need to have multiple tuples in the list that I could add via a for loop. How can I accomplish this?

1 Answers
Related