内建属性
常见的专有属性
如图上面是部分私有属性,现在对getattribute函数进行分析和分析。
下面分析一下__getattribute__函数
class Itcast(object):
def __init__(self,subject1):
self.subject1 =subject1
self.subuject2 =subject2
#属性访问时拦截器,打log
def __getattribute__(self,obj):
print('===1>%s'obj)
return 'redirect python'
else:
temp =object.__getattribute__(self,obj)
#return temp
def show(self):
print('this is Itcast')
s= Itcast('python')
print(s.subject1)
print(s.subject2)
s.show()