0

Can someone please explain the difference between:

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

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

and

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

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

It's quite confusing for me. Thanks

0 Answers0