Dec-02-2020, 02:04 PM
class test: def __init__(self,val=[]): self.val=val a=test() b=test() print(id(a.val)==id(b.val)) #TrueI noticed that the default value of the arguments has the same id as other instances.
And by changing that value, it changes for other instances.
a.val+=[12] print(b.val) # [12]Is this normal for you?