Description
Say I have the following function, which makes a call to another function:
def f1(arg1, arg2, arg3):
f2(...)
The arguments of f1
and f2
are the same, or f2
might look like this:
def f2(**kwargs)
pass # whatever
The client code is going to define and call f1
, and it is required that the signature of f1
explicitly defines all arguments, and thus no **kwargs
is allowed for f1
.
So, to make a call to f2
from inside f1
I have to do this:
def f1(arg1, arg2, arg3):
f2(arg1, arg2, arg3)
Question
Is there a way I can pass arguments to f2
without explicitly writing them? Ideally, I think it should look like this:
def f1(arg1, arg2, arg3):
kwargs = <Some Magic Here>
f2(**kwargs)
Any magic?
UPDATE
Possible Solution
Is there a way I can combine locals()
and inspect.getargspec()
to aggregate my **kwargs
?