I want to create a generic function that takes as argument different kind of objects which have different types of parameters, like this :
def func(obj, param, param_values):
for param_value in param_values:
obj.setParam(param=param_value)
# do some stuff
end
Now I would like to call that function with different objects, which take different parameters names, as such:
func(obj1(), width, {1,2,3,4})
func(obj2(), height, {4,5,6})
However, when I write it this way, I have an error saying that 'param' is not a parameter of obj1 and obj2.
How can I write my function such that it's the value of 'param' that is read and not the word 'param'? Same goes for 'param_value' as I'm anticipating that it could lead to the same problem.