title: Iteration of list (length n) to contain every possible variation of a set X where n is larger than len(unique(X))
body: <p><code>itertools.permutation(iterate, r)</code> provides a way to provide a set of permutations of either length <code>r</code> or <code>len(iterate)</code>. However it does not work if -</p>
  
  <p>r > <code>len(iterate)</code></p>
  
  <p>Take this example.</p>
  
  <p><code>list(intertools.permutation([0, 1, 2]))</code> returns...</p>
  
  <p><code>[(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)]</code></p>
  
  <p>This is expected.</p>
  
  <p>But lets say that we would like r to be larger than the length of the iterate. i.e. if you iterate a set [0, 1, 2] over a length of 4 you would hope to get this sort of answer as below.</p>
  
  <pre><code>[[0, 0, 0, 0]
   [0, 0, 0, 1]
   [0, 0, 0, 2]
   [0, 0, 1, 1]
   [0, 0, 1, 2]
   ...
   [2, 2, 1, 2]
   [2, 2, 2, 0]
   [2, 2, 2, 1]
   [2, 2, 2, 2]]
  </code></pre>
  
  <p>however when you try <code>list(itertools.permutation([0, 1, 2], 4))</code> it returns <code>[]</code> i.e. empty</p>
  
  <p>If anyone knows of a way to do this please tell me.</p>