title: Python list comprehension: Unlist if list contains only one element
body: <p>I have got the following function:</p>
  <pre><code>output_names = [output.name for output in session.get_outputs()]
  </code></pre>
  <p><code>session.get_outputs()</code> can return multiple multiple objects which I want to get the name property from. If the length of the list is 1, I want to <code>output_names</code> to be a value, not a list with a single value.</p>
  <pre><code>output_names = [output.name for output in session.get_outputs()]
  if len(output_names) == 1:
      output_names = output_names[0]
  </code></pre>
  <p>I could do it like this, but this feels like a code smell. It there a more elegant way to solve this?</p>