title: Python inline conditional in string concatenation
body: <p>I had this:</p>
  
  <pre><code>msg = time + b' - ' + Logger.LEVELS_WORD[msg_loglevel] + b': ' + msg.encode('utf-8') + b'\n'
  </code></pre>
  
  <p>Since sometimes msg was already bytes, I wanted to concat msg.encode('utf-8') if it was string or else just msg, so I did this:</p>
  
  <pre><code>msg = time + b' - ' + Logger.LEVELS_WORD[msg_loglevel] + b': ' + msg if isinstance(msg, bytes) else msg.encode('utf-8') + b'\n'
  </code></pre>
  
  <p>But it is not working as I expected, since now <code>msg equals msg</code>. (time + log level isn't getting added).</p>
  
  <p>Should I do if/else instead?</p>