title: Python: Is this list index's value equal to any other index's value?
body: <p>I have a list of tuples that starts out empty and is appended with new user-generated tuples.</p>
  
  <pre><code>if left_mouse == True:
      generic_list.append((mouse_position_x, mouse_position_y))
  </code></pre>
  
  <p>To prevent having multiple tuples with the same (x, y) data, I want to iterate through the list and check if the newest tuple is the same as any other tuple in the list, and if it is, replace the old tuple with the new one.</p>
  
  <pre><code>for tuple in tuple_list:
      if tuple_list[-1].position == tuple_list[i].position:
           tuple_list.remove(i)
  </code></pre>
  
  <p>I know what I've got is wrong, but I don't know why or how to move forward. Any help would be really appreciated.</p>
  
  <p>Edit: I'm now using set() and it works perfectly. Thanks everyone.</p>