最贊回答 / 不會換氣的魚
那你還是沒明白本章在講什么。本章講的就是:用裝飾器@property?把?get/set?方法“裝飾”成屬性調用把?方法?裝飾成?屬性當然,具體的實現細節還得看@property的源碼,現在只要知道@property的用途就足夠了。
2015-04-16
最新回答 / 人間世界
def __init__(self, name, score):? ? ? ? self.name = name? ? ? ? if score<=100:? ? ? ? ? ? self.__score = score? ? ? ? else:? ? ? ? ? ? raise ValueError('wrong')
2015-04-14