[Tutor] c-api question

prefetch prefetch at gmail.com
Fri Aug 6 17:57:16 CEST 2004


hi all,

i'm wonder what the "accepted python way" to do the following is:

i've got a c module like this:

char ** SortEachBlock(char ** BlockList, int BlockSize, int ListSize) {

    for(i = 0; i < ListSize;i++) {
        myqsort(BlockList[i], BlockSize)
    }
    return BlockList;
}

make sense?  it's sorting each array in an array, then returning it.

how would i "pythonize" this?  would i use something like this?

    static PyObject *
    SortEachBlock(PyObject * self, PyObject *args)

and then how would i return my char** ?

    return Py_BuildValue("s", &BlockList);

and how would i pass my BlockList to this in python?

does anyone know..?


More information about the Tutor mailing list