title: Simple syntax error in Python if else dict comprehension
body: <p>I have a set and dictionary and a value = 5</p>
  
  <pre><code>v = s = {'a', 'b', 'c'}
  d = {'b':5 //&lt;--new value}
  </code></pre>
  
  <p>If the key 'b' in dictionary d for example is in set s then I want to make that value equal to the new value when I return a dict comprehension or 0 if the key in set s is not in the dictionary d.  So this is my code to do it where s['b'] = 5  and my new dictionary is is ...</p>
  
  <pre><code>{'a':0, 'b':5, 'c':0}
  </code></pre>
  
  <p>I wrote a dict comprehension</p>
  
  <pre><code>{  k:d[k] if k in d else k:0 for k in s}
                            ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>Why?! Im so furious it doesnt work.  This is how you do if else in python isnt it??</p>
  
  <p>So sorry everyone.  For those who visited this page I originally put  {  k:d[k] if k in v else k:0 for k in v} and s['b'] =  5 was just a representation that the new dictionary i created would have a key 'b' equaling 5, but it isnt correct cus you cant iterate a set like that.</p>
  
  <p>So to reiterate v and s are equal. They just mean vector and set.</p>