标签:object self == lse att bsp item int cat
先看一个案例
class Tree(object): def __init__(self,name): self.name=name self.cate=‘plant‘ def __getattribute__(self, item): if item==‘大树‘: print(‘log 大树‘) return ‘我爱大树‘ else: return object.__getattribute__(self,item) aa=Tree(‘rrrr‘) print(aa.name) print(aa.cate)
运行结果:
rrrr
plant
标签:object self == lse att bsp item int cat
原文地址:https://www.cnblogs.com/Kerryworld/p/10812798.html