How to I determine the default value for a given function parameter at runtime?
<p>Using python 2.4, I'm attempting to identify, at runtime, which of an arbitrary function's arguments have default values. Unfortunately, although I can find what the default values are, I can't seem to get a handle on which parameters they correspond to. For example:</p>

<pre><code>def foo(a, b, c=5):
    return a + b + c

import inspect
inspect.getargspec(foo) # output is: (['a', 'b', 'c'], None, None, (5,))
</code></pre>

<p>The output of <code>getargspec</code> is clearer in python 2.6, which returns a named tuple:</p>

<p><code>ArgSpec(args=['a', 'b', 'c'], varargs=None, keywords=None, defaults=(5,))</code></p>

<p>Python obviously has enough information to accomplish the task during execution. How can I get at it?</p>
