Is there a way to call a function with an argument but have the argument in a way that the default value of the function is used instead? Like
def f(val="hello"):
print(val)
def g(a=Undefined): #replace Undefined with something else
f(a)
>>> g()
hello
The reason is, the called function is not under my control and I want to inherit its default value. Of course I could
def h(a=None):
f(a) if a else f()
or even
def k(a=None):
j = lambda : f(a) if a else f()
j()
since I have to call that function a few times and also pass other parameters. But all that would be much easier if I could just tell the function I want to use its default value.
I could also simply copy paste the default value to my function, but don't want to update my function if the other one changes.