property可以把实例方法当作实例属性来做:

class  Index():
	@property
	def test(self)
	    return a
	def __str__(self):
		return 'sd' ---一定要返回字符串
	
	def __call__(self):
		print(123)------把对象当成函数时调用该方法
index = index()
index.test----把方法可以直接当作属性来使用

把方法当成属性直接使用

str()方法:可以直接打印对象来调用__str__方法
index = Index()
print(index)----sd

call()方法:可以直接调用对象,把实例对象当成函数操作就相当于自动调用__call__方法

index = Index()
index() ----调用实例对象,自动执行类中定义的__call__方法,打印123

整清楚:__str__和__call__方法的使用