title: Get argument names of callable objects in the way they are called
body: <p>I know that <code>inspect.getargspec</code> can be used to get the names of function arguments:</p>
  
  <pre><code>&gt;&gt;&gt; from inspect import getargspec
  &gt;&gt;&gt; def foo1(a, b):
  ...     pass
  ...
  &gt;&gt;&gt; getargspec(foo1).args
  ['a', 'b']
  </code></pre>
  
  <p>But the following is not what I expected:</p>
  
  <pre><code>&gt;&gt;&gt; class X(object):
  ...     def foo2(self, a, b):
  ...         pass
  ...
  &gt;&gt;&gt; x = X()
  &gt;&gt;&gt; getargspec(x.foo2).args
  ['self', 'a', 'b']
  </code></pre>
  
  <p>and also:</p>
  
  <pre><code>&gt;&gt;&gt; from functools import partial
  &gt;&gt;&gt; def foo3(a, b, c):
  ...     pass
  ...
  &gt;&gt;&gt; foo4 = partial(foo3, c=1)
  &gt;&gt;&gt; getargspec(foo4).args
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "C:\Python27\lib\inspect.py", line 816, in getargspec
      raise TypeError('{!r} is not a Python function'.format(func))
  TypeError: &lt;functools.partial object at 0x000000000262F598&gt; is not a Python function
  </code></pre>
  
  <p>How can I make <code>foo1</code>, <code>x.foo2</code> and <code>foo4</code> all return <code>['a', 'b']</code>?</p>