title: Python check if object is in list of objects
body: <p>I have a list of objects in Python.  I then have another list of objects.  I want to go through the first list and see if any items appear in the second list.</p>
  
  <p>I thought I could simply do</p>
  
  <pre><code>for item1 in list1:
      for item2 in list2:
          if item1 == item2:
              print "item %s in both lists"
  </code></pre>
  
  <p>However this does not seem to work.  Although if I do:</p>
  
  <pre><code>if item1.title == item2.title:
  </code></pre>
  
  <p>it works okay.  I have more attributes than this though so don't really want to do 1 big if statement comparing all the attributes if I don't have to.</p>
  
  <p>Can anyone give me help or advise on what I can do to find the objects which appear in both lists.</p>
  
  <p>Thanks</p>