title: What does the == operator actually do on a Python dictionary?
body: <p>Consider: </p>
  
  <pre><code>&gt;&gt;&gt; a = {'foo': {'bar': 3}}
  &gt;&gt;&gt; b = {'foo': {'bar': 3}}
  &gt;&gt;&gt; a == b
  True
  </code></pre>
  
  <p>According to the python doc, <a href="http://docs.python.org/2/library/stdtypes.html#dict" rel="noreferrer">you can indeed use</a> the <code>==</code> operator on dictionaries. </p>
  
  <p>What is actually happening here? Is Python recursively checking each element of the dictionaries to ensure equality? Is it making sure the keys are identically matched, and the values are also identically matched?</p>
  
  <p>Is there documentation that specifies exactly what <code>==</code> on a dictionary means? Or whether I have to implement my own version of checking for equality?</p>
  
  <p>(If the <code>==</code> operator works, why aren't dicts hashable? That is, why can't I create a set() of dicts, or use a dict as a dictionary key?)</p>