fork download
  1. class Foo(object):
  2. def __init__(self):
  3. self._value = "Bar"
  4.  
  5. def get_value(self):
  6. return self._value
  7.  
  8. def set_value(self, val):
  9. self._value = val
  10.  
  11. def del_value(self):
  12. del self._value
  13.  
  14. Foo.value = property(get_value, set_value, del_value)
  15. f = Foo()
  16.  
  17. print f.value
  18. f.value = "Foo"
  19. print f.value
Success #stdin #stdout 0.02s 9016KB
stdin
Standard input is empty
stdout
Bar
Foo