我想要一个在更改对象引用计数时运行的方法。是否有类似以下代码的方法?
class Foo():
def __method__(self):
print("ojbect reference count is changed !")
a = Foo()
b = a # runs __method__ because the reference count is increased
c = b # runs __method__ because the reference count is increased
del b # runs __method__ because the reference count is decreased
del c # runs __method__ because the reference count is decreased
感谢。