title: What does "dict-like" mean in Python?
body: <p>Occasionally people refer to "X-like" objects in Python. <a href="http://patsy.readthedocs.org/en/latest/API-reference.html">Example:</a></p>
  
  <blockquote>
    <p>data_iter_maker – A zero-argument callable which returns an iterator over dict-like data objects.</p>
  </blockquote>
  
  <p>Does "dict-like" have a precise definition, and if so, what is it? Would it be an object <code>x</code> that can be indexed like a dictionary can: <code>x[a]</code>, where <code>a</code> is a hashable? In that case, a namedtuple might not be considered dict-like, since you can't index using an expression like <code>x['a']</code> (last I checked you have to write <code>x.a</code>). But on the other hand, namedtuples are functionally so similar to dicts that I'm not sure what to think. </p>
  
  <p>Cynically, I'm tempted to guess that "dict-like" means "an object similar enough to dict that my code will produce the same answer as if you had submitted a semantically equivalent dict object". In other words, "run the function and find out for yourself if your argument is dict-like!"</p>
  
  <p>More generally, is an X-like object one which implements the same interface as X?</p>