Given a set of functions that differ in their signatures and a dictionary that contains (key, value) pairs for each of the required arguments, I want to find an elegant way of passing the dictionary to each function, so that each function may use the parameters from the function it requires.
def first_function(name, age):
print(name, " ", age)
def second_function(name, gender):
print(name, " ", gender)
param_dict = {'name': 'Max', 'age': 23, 'gender':'m'}
Passing the param_dict to the function by specifying second_function(**param_dict) throws an error as neither function requires for all three parameters. Is there an elegant solution, such that each functions 'extracts' the parameters it requires?