title: How to exclude an object from a list in Python while looping
body: <p>I'm writing a program in which I loop through a list of objects. Inside that loop is a second loop, which loops through all the objects except the current object from the first loop. This repeats several times:</p>
  
  <pre><code>for obj1 in obj_list:
      for obj2 in (obj_list except obj1):
          for obj3 in (obj_list except obj1 and obj2):
              ...
  </code></pre>
  
  <p>My actual code does some stuff in between the loops, so I can't just use <code>permutations()</code> from <code>itertools</code> or something similar. I could implement it like this:</p>
  
  <pre><code>for i1 in range(len(obj_list)):
      obj1 = obj_list[i1]
      for i2 in range(len(obj_list)-1):
          obj2 = (obj_list[:i1] + obj_list[i1 + 1:])[i2]
          ...
  </code></pre>
  
  <p>However, this makes for cluttered code and becomes very messy as I try to exclude multiple objects. Is there a concise way to implement this idea, something similar to the first code block, that doesn't end up modifying the original list? Note that there are no repeated objects in my list, so a method that does not allow for them is fine.</p>