class X:
def __init__(self, d={}):
self.x = []
d['any'] = self.x
def append(self, i):
self.x.append(i)
x = X()
x.append(3)
x.append(13)
x.append(123213)
print(x.x) # show [3, 13, 123213]
The question is, what happens to d
? Is it garbage collected? If it is, how does x
still exist?