I think many people have seen the python's function which receives default parameters. For example:
def foo(a=[]):
a.append(3)
return a
If we call this function using foo(), the output will append integer '3' each time after the call.
When this function is defined, a function object named 'foo' is defined in the current environment, and also the default parameter values are evaluated at this time. Every time when the function is called without a parameter, the evaluated parameter value will be changed according to the code.
My question is, where is this evaluated parameter exist? Is it in the function object or it is in the method object when calling the function? Since everything in python is a object, there must be some place to hold the name->value binding of 'a'-->evaluated parameter. Am I over-thinking this problem?