def a(b=[1]): b[0] += 1 b.append(1) print b a() a() a() 9 >>> [2, 1] >>> [3, 1, 1] >>> [4, 1, 1, 1]
b = [1] def a(): b[0] += 1 b.append(1) print b a()