title: hasattr for nested attributes
body: <p>I need something like this (pseudocode):</p>
  
  <pre><code>if hasattr(object, 'detail.infotext')
  </code></pre>
  
  <p>I mean I want to check if object has attribute <code>details</code> and if it has, then if <code>details</code> has a attribute named <code>infotext</code></p>
  
  <p>I could do it like this:</p>
  
  <pre><code>if hasattr(object, 'detail'):
      if hasattr(object.detail, 'infotext'):
          do something
  </code></pre>
  
  <p>But one-liners are so much easier to read.</p>