I have a list of tuples and need to delete tuples if its 1st item is matching with 1st item of other tuples in the list. 3rd item may or may not be the same, so I cannot use
You should avoid modifying your list in place while iterating over it. Instead, you can use the popular itertools unique_everseen recipe, also available in 3rd party more_itertools. Just use operator.itemgetter in the key argument:
from more_itertools import unique_everseen
from operator import itemgetter
res = list(unique_everseen(L, key=itemgetter(0, 1)))
This solution takes O(n) time, but is generally less efficient than a dictionary-based solution, although it is arguably clearer in its intention.