title: All possibilities to split a list into two lists
body: <p>I have a list with some elements and want to iterate over all possible ways to divide this list into two lists. By that I mean all combinations, so the order doesn't matter (i.e. Element 1 and 3 could be in the one list and Element 2 in the other). Currently I do it like this, where <code>facs</code> is my initial list:</p>
  
  <pre><code>patterns = []
  for i in range(2**(len(facs)-1)):
      pattern = []
      for j in range((len(facs)-1)):
          pattern.append(i//(2**j)%2)
      patterns.append(pattern)
  
  for pattern in patterns:
      l1 = [facs[-1]]
      l2 = []
      for i in range(len(pattern)):
          if pattern[i] == 1:
              l1.append(facs[i])
          else:
              l2.append(facs[i])
  </code></pre>
  
  <p>So I basically create a list of length <code>2^(len(facs)-1)</code> and fill it with every possible combination of ones and zeros. I then 'overlay' every pattern with <code>facs</code>, except for the last element of <code>facs</code> which is always in <code>l1</code>, as I'd otherwise get every result twice, as I handle two lists the same, no matter what lists is <code>l1</code> or <code>l2</code>.</p>
  
  <p>Is there a faster and more elegant (shorter/more pythonic) way to do this?</p>