title: How to customize 'has_key' or 'in' method of a Python dictionary
body: <p>I have a python dictionary that has objects as keys.
  The objects have certain attributes say:</p>
  
  <p>class Ex:
  text
  count
  id</p>
  
  <p>How do I enable constant time searching for an object with value equal to some text 'xyz'</p>
  
  <p>Ex obj1
  Ex obj2
  Ex obj3
  map = {obj1 : 1, obj2 : 2, obj3 : 3}</p>
  
  <p>I want to know whether the 'has_key' or 'in' method of Python dictionary can achieve fetching objects with a particular attribute in constant time,i.e., </p>
  
  <p>map.has_key('xyz') will return me the presence of the corresponding object with text attribute as 'xyz' in constant time.</p>