title: Why to use __setattr__ in python?
body: <p>I don't know for why using <code>__setattr__</code> instead simple referencing like <code>x.a=1</code>. </p>
  
  <p>I understand this example:</p>
  
  <pre><code>class Rectangle:
      def __init__(self):
          self.width = 0
          self.height = 0
  
  
  x=Rectangle()
  x.width=20
  x.__setattr__('height',30)
  setattr(x,'width',99)
  </code></pre>
  
  <p>but don't get why using code depending on string ('height').</p>
  
  <p>Could you explain me what are advantages of <code>__setattr__</code> ?</p>