Roy Chen wrote: > Hi everyone, been looking at the following functions, but can't > figure out how they work. > > def f(a, L=[]): > L.append(a) > return L > > def g(a, L=None): > if L == None: > L = [] > L.append(a) > return L
http://effbot.org/pyfaq/why-are-default-values-shared-between-objects.htm Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor