I need to understand why the calls to this function amends to the array which got a default initialization in the function declaration? Appreciate if any reference to the API specs
def f(i, values = []):
values.append(i)
print(values)
return values
Calls to:
- f(1) prints -> [1]
- f(2) prints -> [1, 2]
- f(3) prints -> [1, 2, 3]
and so one