title: Convert list to list of ids
body: <p>Python 3.3:</p>
  
  <p>What is the easiest way to obtain from the list:</p>
  
  <pre><code>input = ["A", 112, "apple", 74, 112]
  </code></pre>
  
  <p>following list:</p>
  
  <pre><code>output = [0, 1, 2, 3, 1]
  </code></pre>
  
  <p>That is, assign automatically incremented id starting from 0 to every unique entry, and convert the original list to the list of this ids.</p>
  
  <p>I am aware, that I can obtain cheap the number of classes by</p>
  
  <pre><code>number_of_classes = len(set(input))
  </code></pre>
  
  <p>But how to create correctly ordered output?</p>