def f(arg=[]): if arg: print arg else: arg.append(42) f([1, 2, 3]) f([]) f() f()