Created
March 22, 2012 11:34
-
-
Save mingyc/2157821 to your computer and use it in GitHub Desktop.
An example of the usage of property() as decorator.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Circle(object): | |
def __init__(self, radius): | |
self._radius = radius | |
@property | |
def radius(self): | |
return self._radius | |
@radius.setter | |
def radius(self, value): | |
self._radius = value | |
@radius.deleter | |
def radius(self): | |
del self._radius |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment