I have wrapped some C code using SWIG to use it as a python library.
Within this framework, some python code I have written calls a C function, which returns a string. However, for creating the string, the C function requires a ranking, the generation of which I have implemented in Python. How would I go about implementing this using callbacks?
I see this as the following multistep process.
1) Python instantiates a C object: import test_Objects #test_Objects is the C file that has been wrapped C = test_objects.my_class()
2) Call the relevant method on the my_class object, which return a string: txt_1 = "string1" txt_2 - "string2" result = C.sorted_string(txt_1, txt_2)
2.1) I want sorted_string to call the following python function, which returns a sorted list.
def sorted_string([my_list]):
.....
.....
return your_list
2.2) Sorted_string would make use of the list to generate the result.
How would I implement step 2.1?