The default argument list is the same object for all instances, so assigning it to a member simply assigns a reference to the same object.
here is an example:
>>> class foo(): ... def __init__(self, x = []): ... print id(x) ... >>> x = foo() 140284337344168 >>> y = foo() 140284337344168 >>> z = foo() 140284337344168
you can see that x is the same object in all instances.
Not_a_Golfer
source share