title: In python how does "if-else and for" in a dictionary comprehension work
body: <p>I am confused with the following line of code:</p>
  
  <pre><code>data = {n.attributes['xid']: float(n.content) if n.content else np.nan for n in graph.by_tag('value') }
  </code></pre>
  
  <p>The dictionary comprehension consists of <code>if-else</code> and <code>for</code> loop. Can anyone explain me how the code works?</p>