I just was messing around in Python and I made a function called f
. I gave it a keyword/named argument with a default value initialized by some variable:
>>> test = "first"
>>>
>>> def f(test_arg=test):
... print(test_arg)
>>>
>>> f()
first
>>> test = "second"
>>> f()
first
I changed that variable's contents, but the argument's default value did not update.
How can I change the value of the default argument?