class Fruit:
def __init__(self,name):
print("init执行")
def __getattr__(self, item):
print("get 执行")
def __setattr__(self, key, value):
print("set 执行")
self.__dict__[key]=value
def __delattr__(self, item):
print("del 执行")
# self.__dict__.pop(item)
apple=Fruit("apple") # init执行
apple.color="red" # set 执行
apple.color="green" #set 执行
del apple.color #del 执行
apple.shape #get 执行