> One of the functions in a C extension I'm writing needs to return a > tuple of integers, where the length of the tuple is only known at > runtime. I'm currently doing a loop calling PyInt_FromLong to make the > integers, then PyTuple_New, and finally a loop calling PyTuple_SET_ITEM > to set the tuple's items. Whew. > > Does anyone know of a simpler way? I can't use Py_BuildValue because I > don't know at compile-time how many values there are going to be. And > there doesn't seem to be a PyTuple_FromArray() function. > > If I'm overlooking something obvious, please clue me in!
If you already know _how_ to create a function like PyTuple_FromArray() - why don't you define it yourself and use it? -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list