title: attr = x.y.z if x.y else None gives AttributeError
body: <p>I wondered what's the best method to solve following error:</p>
  <pre><code>'tuple' object has no attribute 'z'
  </code></pre>
  <p>from following code:</p>
  <pre><code>output = (x.y.z if x.y else None)
  </code></pre>
  <p>is it enough to just do:</p>
  <pre><code>output = (x.y.z if x.y.z else None)
  </code></pre>
  <p>Or will this also cause an <code>AttributeError</code>?</p>