def fun(L=[0]):
L[0]+=1
return L[0]
print fun(),fun(),fun(),fun() # will produce 1 2 3 4
this use the default variable.
the default variable value should be a list.
def fun(L=[0]):
L[0]+=1
return L[0]
print fun(),fun(),fun(),fun() # will produce 1 2 3 4
this use the default variable.
the default variable value should be a list.