Why the default value assignmnet defined for a variable in a function is not executed every time we call the function? For example check out this example:
def foo(var=[]):
var.append(1)
return var
foo()
[1]
foo()
[1,1]
when running the function the 2nd time, the default value of the var variable is already set to be one while we clearly asked the function to set it to an empty list if the function is called with no values! What's the logic behind this behavior?