fork download
  1. class Props(object):
  2. _x = 0
  3. #@property
  4. def x(self):
  5. print "get x"
  6. return self._x
  7. #@x.setter
  8. def x(self, x):
  9. print "set x"
  10. self._x = x
  11.  
  12. props = Props()
  13. print str(dir(props))
  14. props.x = 5
  15. print props.x
  16. print str(dir(props))
Success #stdin #stdout 0.03s 6356KB
stdin
Standard input is empty
stdout
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_x', 'x']
5
['__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_x', 'x']