I'm reading the Python.org tutorial right now, and I found this part rather
strange and incomprehensible to me>
Important warning: The default value is evaluated only once. This makes a
difference when the default is a mutable object such as a list, dictionary, or
instances of most classes
def f(a, L=[]):
L.append(a)
return L
print(f(1))
print(f(2))
print(f(3))
This will print
[1]
[1, 2]
[1, 2, 3]
How the list is retained between successive calls? And why?
--
http://mail.python.org/mailman/listinfo/python-list