title: Python ? (conditional/ternary) operator for assignments
body: <p>C and many other languages have a <a href="http://www.eskimo.com/%7Escs/cclass/int/sx4eb.html" rel="noreferrer">conditional (AKA ternary)</a> operator.  This allows you to make very terse choices between two values based on the truth of a condition, which makes expressions, including assignments, very concise.</p>
  <p>I miss this because I find that my code has lots of conditional assignments that take four lines in Python:</p>
  <pre><code>if condition:
      var = something
  else:
      var = something_else
  </code></pre>
  <p>Whereas in C it'd be:</p>
  <pre><code>var = condition ? something : something_else;
  </code></pre>
  <p>Once or twice in a file is fine, but if you have lots of conditional assignments, the number of lines explode, and worst of all the eye is drawn to them.</p>
  <p>I like the terseness of the conditional operator, because it keeps things I deem un-strategic from distracting me when skimming the code.</p>
  <p>So, in Python, is there a trick you can use to get the assignment onto a single line to approximate the advantages of the conditional operator as I outlined them?</p>