Python C API return more than one value / object
- by Grisu
I got the following problem. I have written a C-Extension to Python to interface a self written software library. Unfortunately I need to return two values from the C function where the last one is optional. In Python the equivalent is
def func(x,y):
return x+y, x-y
test = func(13,4) #only the first value is used
In my C extension I use…