title: Syntax error in ternary if-else statement
body: <p>We can use if-else like this:</p>
  <pre><code>statement if condition else statement
  </code></pre>
  <p>but there are some problems here and I can't understand why.</p>
  <ol>
  <li><p>If I run <code>count += 1 if True else l = []</code> (count is defined already), then it raises an error:</p>
  <pre><code> File &quot;&lt;ipython-input-5-d65dfb3e9f1c&gt;&quot;, line 1
   count += 1 if True else l = []
                             ^
   SyntaxError: invalid syntax
  </code></pre>
  <p>Can we not assign a value after else?</p>
  </li>
  <li><p>When I run <code>count += 1 if False else l.append(count+1)</code> (note: count = 0, l = []), an error will be raised:</p>
  <pre><code> TypeError    Traceback (most recent call last)
   &lt;ipython-input-38-84cb28b02a03&gt; in &lt;module&gt;()
   ----&gt; 1 count += 1 if False else l.append(count+1)
  
   TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'
  </code></pre>
  <p>and the result of l is <code>[1]</code>.</p>
  </li>
  </ol>
  <p>Using the same conditions, if I use an if-else block, there are no errors.</p>
  <p>Can you explain the difference?</p>