If you're trying to get the actual index values for some reason (and/or need to control the inner loop separate from the outer), you'd do:
for i in range(len(mylist)):
for j in range(i+1, len(mylist)):
# Or for indices and elements:
for i, x in enumerate(mylist):
for j, y in enumerate(mylist[i+1:], start=i+1):
But if what you really want is unique non-repeating pairings of the elements, there is a better way, itertools.combinations:
import itertools
for x, y in itertools.combinations(mylist, 2):
That gets the values, not the indices, but usually, that what you really wanted. If you really need indices too, you can mix with enumerate:
for (i, x), (j, y) in itertools.combinations(enumerate(mylist), 2):
Which gets the exact index pattern you're looking for, as well as the values. You can also use it to efficiently produce the indices alone as a single loop with:
for i, j in itertools.combinations(range(len(mylist)), 2):
Short answer: itertools is magical for stuff like this.
list(or any other built-in name). That's just asking for trouble. My answer usedmylistas a safe placeholder.