Skip to content

Instantly share code, notes, and snippets.

@majgis
Created October 17, 2012 01:35
Show Gist options
  • Save majgis/3903243 to your computer and use it in GitHub Desktop.
Save majgis/3903243 to your computer and use it in GitHub Desktop.
Python get and set methods
class C(object):
def __init__(self, x=None):
self.x = x
@property
def x(self):
return self._x
@x.setter
def x(self, value):
self._x = value
c = C(5)
print c.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment