title: Python sequence translation
body: <p>I have a list of tuples like <code>[(0, 34), (1, 77), (2, 6), (3, 60), (6, 2), (7, 5), (9, 13), (14, 2)]</code>. I need to keep the tuples order and reenumerate second elements with integers from 0 to n - 1, where n is the list length. The result should be <code>[(0, 4), (1, 6), (2, 2), (3, 5), (6, 0), (7, 1), (9, 3), (14, 0)]</code>.</p>
  
  <p>I began writing a function that accepts integer sequences, but not integer pairs:</p>
  
  <pre><code>def translation(seq):
      return [sorted(set(seq)).index(x) for x in seq]
  
  &gt;&gt;&gt; translate([34, 77, 6, 60, 2, 5, 13, 2])
  [4, 6, 2, 5, 0, 1, 3, 0]
  </code></pre>
  
  <p>`</p>