Hi to all

I have a beginner question to which I have not found an answer I was able to 
understand.  Could someone explain why the following program:

def f(a, L=[]):
    L.append(a)
    return L

print(f(1))
print(f(2))
print(f(3))

gives us the following result:

[1]
[1,2]
[1,2,3]

How can this be, if we never catch the returned L when we call it, and we never 
pass it on back to f???

Any help is appreciated.
Marcin
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to