class CCC:

  @property
  def aa(self):
    print(123)

CCC().aa

 

还有个函数 是给变成变量调用的函数(因为函数加了@property,就不可以传参进去了) , 赋值用的装饰器函数@xxx.setter

装饰器@property,让调用类里面的函数 和 调用类里面的变量一样写法。 含  类中@property与@xxx.setter的方法介绍。

 

 

参考: https://www.cnblogs.com/tangjunjun/p/12078686.html

 

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-17
  • 2021-09-19
  • 2021-11-12
  • 2021-09-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案