title: Python: `key not in my_dict` but `key in my_dict.keys()`
body: <p>I have a weird situation. I have a dict, <code>self.containing_dict</code>. Using the debug probe, I see that dict's contents and I can see that <code>self</code> is a key of it. But look at this:</p>
  
  <pre><code>&gt;&gt;&gt; self in self.containing_dict
  False
  &gt;&gt;&gt; self in self.containing_dict.keys()
  True
  &gt;&gt;&gt; self.containing_dict.has_key(self)
  False
  </code></pre>
  
  <p>What's going on?</p>
  
  <p>(I will note that this is in a piece of code which gets executed on a weakref callback.)</p>
  
  <p><strong>Update:</strong> I was asked to show the <code>__hash__</code> implementation of <code>self</code>. Here it is:</p>
  
  <pre><code>def __hash__(self):
      return hash(
          (
              tuple(sorted(tuple(self.args))),
              self.star_args,
              tuple(sorted(tuple(self.star_kwargs)))
          )
      )
  
  args = property(lambda self: dict(self.args_refs))
  
  star_args = property(
      lambda self:
          tuple((star_arg_ref() for star_arg_ref in self.star_args_refs))
  )
  
  star_kwargs = property(lambda self: dict(self.star_kwargs_refs))    
  </code></pre>