title: Using property decorator to set and get object values in Python
body: <p>I want to use the property decorator to assign values to an attribute of an object.</p>
  <pre><code>class Response:
  
      _result = {}
  
      @property
      def result(self):
          print 'getter'
          return self._result
  
      @result.setter
      def result(self, obj):
          print 'setter'
          self._result.update(obj)
  
      @result.deleter
      def result(self):
          print 'deleter'
          self._result = {}
  
  
  r = Response()
  
  r.result = {'test':123}
  
  print r.result
  </code></pre>
  <p>I must be doing something wrong, because the output is:</p>
  <blockquote>
  <p>{'test': 123}</p>
  </blockquote>
  <p>Why are the print statements not executed?
  What I expect to see is:</p>
  <blockquote>
  <p>setter</p>
  <p>getter</p>
  <p>{'test': 123}</p>
  </blockquote>