title: Types that define `__eq__` are unhashable?
body: <p>I had a strange bug when porting a feature to the Python 3.1 fork of my program. I narrowed it down to the following hypothesis:</p>
  
  <p>In contrast to Python 2.x, in Python 3.x if an object has an <code>__eq__</code> method it is automatically unhashable.</p>
  
  <p>Is this true?</p>
  
  <p>Here's what happens in Python 3.1:</p>
  
  <pre><code>&gt;&gt;&gt; class O(object):
  ...     def __eq__(self, other):
  ...         return 'whatever'
  ...
  &gt;&gt;&gt; o = O()
  &gt;&gt;&gt; d = {o: 0}
  Traceback (most recent call last):
    File "&lt;pyshell#16&gt;", line 1, in &lt;module&gt;
      d = {o: 0}
  TypeError: unhashable type: 'O'
  </code></pre>
  
  <p>The follow-up question is, how do I solve my personal problem? I have an object <code>ChangeTracker</code> which stores a <code>WeakKeyDictionary</code> that points to several objects, giving for each the value of their pickle dump at a certain time point in the past. Whenever an existing object is checked in, the change tracker says whether its new pickle is identical to its old one, therefore saying whether the object has changed in the meantime. Problem is, now I can't even check if the given object is in the library, because it makes it raise an exception about the object being unhashable. (Cause it has a <code>__eq__</code> method.) How can I work around this?</p>