title: single line if else in python dictionary comprehension method
body: <p>I just tried a list comprehension like this</p>
  <pre><code>[i if i==0 else i+100 for i in range(0,3)]
  </code></pre>
  <p>and it worked, but when I tried a similar dict comprehension, it throws an error:</p>
  <pre><code>d={3:3}
  {d[i]:0 if i==3 else d[i]:True for i in range(0,4) }
  </code></pre>
  <p>What could be the reason? How can I use dict comprehension using <code>if else</code>?</p>
  <p>The error this produces:</p>
  <pre><code>    {d[i]:0 if i==3 else d[i]:True for i in range(0,4) }
                               ^
  SyntaxError: invalid syntax
  </code></pre>
  <p>Note: The example I used here is just a random one, not my actual code.
  I can do this with alternative an solution, but I'm only looking at dict comprehensions now to learn.</p>