title: Python: How do sets work
body: <p>I have a list of objects which I want to turn into a set. My objects contain a few fields that some of which are <code>o.id</code> and <code>o.area</code>. I want two objects to be equal if these two fields are the same. ie: <code>o1==o2</code> if and only if <code>o1.area==o2.area and o1.id==o2.id</code>.</p>
  
  <p>I tried over-writing <code>__eq__</code> and <code>__cmp__</code> but I get the error: <code>TypeError: unhashable instance</code>.</p>
  
  <p>What should I over-write?</p>