class test: attr = 1 def __delattr__(self, item): object.__delattr__(self, item) ins = test() print(ins.attr) del ins.attr print(ins.attr)