从文档中:
不能保证
__del__()在解释器退出时为仍然存在的对象调用方法。
如果要确保
a.__del__调用了该方法,则必须显式删除该实例:
a = A()del a # Assuming this is the final reference to the object

从文档中:
不能保证
__del__()在解释器退出时为仍然存在的对象调用方法。
如果要确保
a.__del__调用了该方法,则必须显式删除该实例:
a = A()del a # Assuming this is the final reference to the object