Skip to content

Instantly share code, notes, and snippets.

@mingyc
Created March 22, 2012 11:12
Show Gist options
  • Save mingyc/2157719 to your computer and use it in GitHub Desktop.
Save mingyc/2157719 to your computer and use it in GitHub Desktop.
Example of the usage of built-in property() function.
class Circle(object):
def __init__(self, radius):
self._radius = radius
def _get_radius(self):
return self._radius
def _set_radius(self, value):
self._radius = value
def _del_radius(self):
del self._radius
radius = property(_get_radius, _set_radius, _del_radius, "The radius of the Circle.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment