Is it possible to pass arbitrary number of named default arguments to a Python function conditionally ?
For eg. there\'s a function:
def func(arg, ar
The only way I can think of would be
func("arg", "arg2", **({"arg3": "some value"} if condition == True else {}))
or
func("arg", "arg2", *(("some value",) if condition == True else ()))
but please don't do this. Use the code you provided yourself, or something like this:
if condition:
arg3 = "some value",
else:
arg3 = ()
func("arg", "arg2", *arg3)