title: Why does my python array list not follow order?
body: <p>I am having some trouble with python array list.</p>
  
  <p>I know, that python list should keep its order, but I have script, where this is not true, and I cannot identify why, so I thought you might help me out.</p>
  
  <p>There is little bit more complicated script, that is getting 2 lines from CSV file, take first line with weights, orders them, and than reorders the second line based on first one:</p>
  
  <pre><code>csv_cleared = csv.reader(open(temp_csv_file),  delimiter= ';')  
  vahy = csv_cleared.next()
  vahy_ordered = sorted(vahy, key=int, reverse=True) # orders line
  vahy_ordered_indexes = []
  
  for vaha in vahy:
      index_vahy = vahy_ordered.index(vaha)
      if index_vahy in vahy_ordered_indexes:     # if two mats have same weight
          index_vahy = index_vahy+1 # increment index by one
          vahy_ordered_indexes.append(index_vahy)
      else:
          vahy_ordered_indexes.append(index_vahy)
  </code></pre>
  
  <p>Log:</p>
  
  <pre><code>Vahy: ['49', '3', '19', '8', '19', '39', '11']
  Vahy ordered: ['49', '39', '19', '19', '11', '8', '3']
  Vaha is: 49 Index_vahy is: 0
  Inserted index_vahy: 0 into vahy_ordered_indexes([0])
  Vaha is: 3 Index_vahy is: 6
  Inserted index_vahy: 6 into vahy_ordered_indexes([0, 6])
  Vaha is: 19 Index_vahy is: 2
  Inserted index_vahy: 2 into vahy_ordered_indexes([0, 6, 2])
  Vaha is: 8 Index_vahy is: 5
  Inserted index_vahy: 5 into vahy_ordered_indexes([0, 6, 2, 5])
  Vaha is: 19 Index_vahy is: 2
  Inserted index_vahy: 3 into vahy_ordered_indexes([0, 6, 2, 5, 3]) DOUBLED!!!
  Vaha is: 39 Index_vahy is: 1
  Inserted index_vahy: 1 into vahy_ordered_indexes([0, 6, 2, 5, 3, 1])
  Vaha is: 11 Index_vahy is: 4
  Inserted index_vahy: 4 into vahy_ordered_indexes([0, 6, 2, 5, 3, 1, 4])
  </code></pre>
  
  <p>This works as it should, but problem comes later:</p>
  
  <pre><code>new_line = line[:3]
  line_materials = line[3:-1]
  line_material = 0
  for poradovnik in vahy_ordered_indexes:
      poradie = poradovnik + 3
      print "Poradie is: %s New line before insert is: %s"% (poradie, new_line)
      print "Inserting material: %s into position: %s" % (line_materials[line_material], poradie)
      new_line.insert(poradie, line_materials[line_material])
      print "New line after insert is: %s \n"% (new_line)
      line_material += 1
  </code></pre>
  
  <p>Where new_line.insert() function is inserting items with right indexes, but they keep having wrong positions, as shows log:</p>
  
  <pre><code>Poradie is: 3 New line before insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.']
  Inserting material: TESCO 5K into position: 3
  New line after insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K'] 
  
  Poradie is: 9 New line before insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K']
  Inserting material: TESCO expres into position: 9
  New line after insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K', 'TESCO expres'] 
  
  Poradie is: 5 New line before insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K', 'TESCO expres']
  Inserting material: BILLA hlavny into position: 5
  New line after insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K', 'TESCO expres', 'BILLA hlavny'] 
  
  Poradie is: 8 New line before insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K', 'TESCO expres', 'BILLA hlavny']
  Inserting material: Ptacek into position: 8
  New line after insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K', 'TESCO expres', 'BILLA hlavny', 'Ptacek'] 
  
  Poradie is: 6 New line before insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K', 'TESCO expres', 'BILLA hlavny', 'Ptacek']
  Inserting material: Merkury Market SK into position: 6
  New line after insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K', 'TESCO expres', 'BILLA hlavny', 'Merkury Market SK', 'Ptacek'] 
  
  Poradie is: 4 New line before insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K', 'TESCO expres', 'BILLA hlavny', 'Merkury Market SK', 'Ptacek']
  Inserting material: NAY elektrodom into position: 4
  New line after insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K', 'NAY elektrodom', 'TESCO expres', 'BILLA hlavny', 'Merkury Market SK', 'Ptacek'] 
  
  Poradie is: 7 New line before insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K', 'NAY elektrodom', 'TESCO expres', 'BILLA hlavny', 'Merkury Market SK', 'Ptacek']
  Inserting material: TOP Farma into position: 7
  New line after insert is: ['Kod regionu', 'Nazov regionu', 'Platova kat.', 'TESCO 5K', 'NAY elektrodom', 'TESCO expres', 'BILLA hlavny', 'TOP Farma', 'Merkury Market SK', 'Ptacek']
  </code></pre>
  
  <p>It seems like in some cases is item inserted into right position and other cases not, but I am stuck for few days already failing to find out when it is inserting into right position and when not</p>