title: Python Chain getattr as a string
body: <pre><code>import amara
  def chain_attribute_call(obj, attlist):
      """
      Allows to execute chain attribute calls
      """
      splitted_attrs = attlist.split(".")
      current_dom = obj
      for attr in splitted_attrs:
          current_dom = getattr(current_dom, attr)
      return current_dom
  
  doc = amara.parse("sample.xml")
  print chain_attribute_call(doc, "X.Y.Z")
  </code></pre>
  
  <p>In oder to execute chain attribute calls for an object as a string, I had to develop the clumsy snippet above. I am curious if there would be a more clever / efficient solution to this.</p>