Extended function argument syntax – forwarding arguments to other functions
When you want to forward arguments received by your very smart and universal function (defined with *args and **kwargs, of course) to another handy and smart function, you should do that in the following way:
def combiner(a, b, *args, **kwargs):
super_combiner(*args, **kwargs)
def super_combiner(*my_args, **my_kwargs):
print('my_args:', my_args)
print('my_kwargs', my_kwargs)
combiner(10, '20', 40, 60, 30, argument1=50, argument2='66')
When you run the code, you'll get:
my_args: (40, 60, 30)
my_kwargs {'argument1': 50, 'argument2': '66'}
output