When to Use Object-oriented Programming(Chapter 5 of Python 3 Object Oriented Pr
时间:2010-09-02 来源:Ray Z
code
1 class Silly:
2
3 @property
4 def silly(self):
5 "This is a silly property"
6 print("You are getting silly")
7 return self._silly
8
9 @silly.setter
10 def silly(self, value):
11 print("You are making silly {}".format(value))
12 self._silly = value
13
14 @silly.deleter
15 def silly(self):
16 print("Whoah, you killed silly!")
17 del self._silly
2
3 @property
4 def silly(self):
5 "This is a silly property"
6 print("You are getting silly")
7 return self._silly
8
9 @silly.setter
10 def silly(self, value):
11 print("You are making silly {}".format(value))
12 self._silly = value
13
14 @silly.deleter
15 def silly(self):
16 print("Whoah, you killed silly!")
17 del self._silly
相关阅读 更多 +