title: Get a function argument's default value?
body: <p>For this function</p>
  
  <pre><code>def eat_dog(name, should_digest=True):
      print "ate dog named %s. Digested, too? %" % (name, str(should_digest))
  </code></pre>
  
  <p>I want to, external to the function, read its arguments and any default values attached. So for this specific example, I want to know that <code>name</code> has no default value (i.e. that it is a required argument) and that <code>True</code> is the default value for <code>should_digest</code>.</p>
  
  <p>I'm aware of <code>inspect.getargspec()</code>, which does give me information about arguments and default values, but I see no connection between the two:</p>
  
  <p><code>ArgSpec(args=['name', 'should_digest'], varargs=None, keywords=None, defaults=(True,))</code></p>
  
  <p>From this output how can I tell that <code>True</code> (in the <code>defaults</code> tuple) is the default value for <code>should_digest</code>?</p>
  
  <p>Additionally, I'm aware of the "ask for forgiveness" model of approaching a problem, but unfortunately output from that error won't tell me the name of the missing argument:</p>
  
  <pre><code>&gt;&gt;&gt; eat_dog()
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: eat_dog() takes at least 1 argument (0 given)
  </code></pre>
  
  <p>To give context (why I want to do this), I'm exposing functions in a module over a JSON API. If the caller omits certain function arguments, I want to return a specific error that names the specific function argument that was omitted. If a client omits an argument, but there's a default provided in the function signature, I want to use that default.</p>