Skip to content

Instantly share code, notes, and snippets.

@eudaimonious
Created May 1, 2015 00:29
Show Gist options
  • Save eudaimonious/5d2df239328c4ba1bb83 to your computer and use it in GitHub Desktop.
Save eudaimonious/5d2df239328c4ba1bb83 to your computer and use it in GitHub Desktop.
class A(object):
@property
def x(self):
return self._x
@x.setter
def x(self, value):
self._x = value
class B(A):
@A.x.getter
def x(self):
return self._x * 2
hi = A()
bar = B()
hi.x = 'hello'
print hi.x # prints hello
bar.x = 'world'
print bar.x # prints worldworld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment