I have a very generic function call that looks like
result = getattr(class_name, func_name)(result)
This function call updates result
. This function call is very generic such that it can invoke many functions from different classes. Currently, all these functions only take one argument result
. However, it doesn't scale to the cases that some functions need to pass more than just result
but more arguments (say, args
).
Is there a way in Python (2.7) that allows this generic function call to pass args
but still invoke the functions that don't have the extra arguments? If not, what would be a better approach to solve this problem?
EDIT: I cannot change the existing function definitions, including those that only take only the argument result
. I can only change this line:
result = getattr(class_name, func_name)(result)