title: Can I use a dynamic mapping to unpack keyword arguments in Python?
body: <p>Long story short, I want to call format with arbitrarily named arguments, which will preform a lookup.</p>
  
  <pre><code>'{Thing1} and {other_thing}'.format(**my_mapping)
  </code></pre>
  
  <p>I've tried implementing my_mapping like this:</p>
  
  <pre><code>class Mapping(object):
    def __getitem__(self, key):
      return 'Proxied: %s' % key
  my_mapping = Mapping()
  </code></pre>
  
  <p>Which works as expected when calling <code>my_mapping['anything']</code>. But when passed to format() as shown above I get:</p>
  
  <pre><code>TypeError: format() argument after ** must be a mapping, not Mapping
  </code></pre>
  
  <p>I tried subclassing <code>dict</code> instead of <code>object</code>, but now calling <code>format()</code> as shown raises <code>KeyError</code>. I even implemented <code>__contains__</code> as <code>return True</code>, but still <code>KeyError</code>.</p>
  
  <p>So it seems that <code>**</code> is not just calling <code>__getitem__</code> on the object passed in. Does anyone know how to get around this?</p>