本文实例讲述了Python中@property的理解和使用。分享给大家供大家参考,具体如下:
重看狗书,看到对User表定义的时候有下面两行
@property
def password(self):
raise AttributeError('password is not a readable attribute')
@password.setter
def password(self, password):
self.password_hash = generate_password_hash(password)
遂重温下这个property的使用
在