So, here is a piece of code:
def function(item, stuff = []):
stuff.append(item)
print stuff
function(1)
# print '[1]'
function(2)
# print '[1,2]'
As I understood, this shows, that default values, changed during program run still changed at every function calls. But why this piece of code:
def function(item, stuff = 0):
stuff += item
print stuff
function(3)
function(3)
prints '3' at every runs?
stuffis re-initialized on every call.