title: Python: Sort list using another list order, having different lengths, and without 'sorted'
body: <p>I'll to explain this right:<br/>
  I'm in an environment where I can't use python built-in functions (like 'sorted', 'set'), can't declare methods, can't make conditions (if), and can't make loops, except for:</p>
  
  <ul>
  <li><p>can call methods (but just one each time, and saving returns on another variable</p>
  
  <p>foo python:item.sort();  #foo variable takes the value that item.sort() returns </p>
  
  <p>bar python:foo.index(x);</p></li>
  <li><p>and can do list comprehension</p>
  
  <p>[item['bla'] for item in foo]</p></li>
  </ul>
  
  <p>...what I don't think that will help on this question</p>
  
  <p>I have a 'correct_order' list, with this values:</p>
  
  <pre><code>correct_order = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  </code></pre>
  
  <p>and I have a 'messed_order' list, with this values:</p>
  
  <pre><code>messed_order = [55, 1, 44, 3, 66, 5, 4, 7, 2, 9, 0, 10, 6, 8]
  </code></pre>
  
  <p>Well, I have to reorder the 'messed_order' list, using the index of 'correct_order' as base. The order of the rest of items not included in correct_order doesn't matter.</p>
  
  <p>Something like this would solve (again, except that I can't use loops):</p>
  
  <pre><code>for item in correct_order:
      messed_order[messed_order.index(item)], messed_order[correct_order.index(item)] = messed_order[correct_order.index(item)], messed_order[messed_order.index(item)]
  </code></pre>
  
  <p>And would result on the 'ordered_list' that I want:</p>
  
  <pre><code>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 55, 66, 44]
  </code></pre>
  
  <p>So, how can I do this?</p>
  
  <p>For those who know zope/plone, I'm on a skin page (.pt), that doesn't have a helper python script (what I think that is not possible for skin pages, only for browser pages. If it is, show me how and I'll do it).</p>