Python 描述符

Python中访问一个属性的优先级

1、类属性

2、数据描述符

3、实例属性

4、非数据描述符(非覆盖型描述符)

5、找不到==> getattr

数据描述符:实现__get__和__set__方法

非数据描述符:只实现__get__方法

property内建函数有四个参数:property(fget=None, fset=None, fdel=None, doc=None)

原文地址:https://www.cnblogs.com/wuzdandz/p/10720236.html