title: Python: And or condition doesn't work properly like if else
body: <p>I'm working with python and i realize that itsn't reliable while sometimes and or statement doesn't work properly without reason</p>
  
  <pre><code>column_exclude_list = []}
  column_exclude_edit = ['id']
  def get_columns(type='list'):
      # exclude_list = column_exclude_list if type=='list' else column_exclude_edit
      exclude_list = type=='list' and column_exclude_list or column_exclude_edit
  
      print(type)
      print(column_exclude_list)
      print(column_exclude_edit)
      print(exclude_list)
  </code></pre>
  
  <p>I tested with this function and it prints:</p>
  
  <pre><code>list
  []
  ['id']
  ['id']
  </code></pre>
  
  <p>After changing to <code>exclude_list = column_exclude_list if type=='list' else column_exclude_edit</code>, it works.</p>
  
  <pre><code>list
  []
  ['id']
  []
  </code></pre>
  
  <p>What's wrong between these two short-hand conditions?</p>