title: python - split a list in pairs and unique elements
body: <p>I'm having a hard time trying to achieve the following:
  I have a list (say, [a,b,c,d]) and I need to partition it into pairs and unique elements in every possible way (order is not important), i.e.:</p>
  
  <pre><code>[a,b,c,d], [(a,b), c,d], [(a,b), (c,d)], [a, (b,c), d], [(a,d), (b, c)]...
  </code></pre>
  
  <p>and so on. <a href="https://stackoverflow.com/questions/5360220/how-to-split-a-list-into-pairs-in-all-possible-ways">This thread</a> solves the problem when only pairs are used, but I need also the unique elements and I cannot get it to do it.
  Any idea will be much appreciated.
  Thanks!</p>