title: Python if else micro-optimization
body: <p>In pondering optimization of code, I was wondering which was more expensive in python:</p>
  
  <pre><code>if x:
      d = 1
  else:
      d = 2
  </code></pre>
  
  <p>or</p>
  
  <pre><code>d = 2
  if x:
      d = 1
  </code></pre>
  
  <p>Any thoughts?  I like the reduced line count in the second but wondered if reassignment was more costly than the condition switching.</p>