In both situation
__del__
doesn't work. I understand that 'del obj' don't delete all references, but why/how/which references created?
Example 1:
class Exp:
def __init__(self):
self.b = 1
self.a = lambda :self.b
def __del__(self):
print('a')
obj = Exp()
obj = None
del obj
Example 2:
class Exp:
def __init__(self):
self.b = 1
self.a = self.test
def test(self):
return 5
def __del__(self):
print('a')
obj = Exp()
obj = None
del obj