#!/usr/bin/python3 import sys class Point: def __init__( self, x=0, y=0): self.x = x self.y = y def __del__(self): class_name = self.__class__.__name__ fun_name = sys._getframe().f_code.co_name print (fun_name,class_name, "destroyed")
p = Point() del p
__del__ Point destroyed
原文地址:https://www.cnblogs.com/idvcn/p/8566650.html
时间: 2024-10-09 19:36:28