I have a function which calls another function using a kwarg to determine if it should be called:
def a(val):
print(val)
def caller(func, call_it=True, *args, **kwargs):
if call_it:
func(*args, **kwargs)
# doesnt work
caller(a, 1)
# works
caller(a, True, 1)
How can this be handled where the call_it argument has a default value but *args are still needed?