class Silly:
@property
def silly(self):
"This is a silly property"
print("You are getting silly")
return self._silly
@silly.setter
def silly(self, value):
print("You are making silly {}".format(value))
self._silly = value
@silly.deleter
def silly(self):
print("Whoah, you killed silly!")
del self._silly
s = Silly()
s.silly = "funny"
value = s.silly
del s.silly
但它并没有像预期的那样打印“你越来越傻”,“你越来越傻了”,...... 不知道为什么。伙计们,你能帮我弄清楚吗?
提前致谢!