[Python-Dev] Quick poll: should help() show bound arguments?

Chris Angelico rosuav at gmail.com
Sat Jan 25 13:34:47 CET 2014

On Sat, Jan 25, 2014 at 3:07 PM, Larry Hastings <larry at hastings.org> wrote:
> What should it be?
> A) pydoc and help() should not show bound parameters in the signature, like
> inspect.signature.
> B) pydoc and help() should show bound parameters in the signature, like
> inspect.getfullargspec.

Vote for A. As far as I'm concerned, all these foo are equally
callable and equally take one parameter named a:

def foo1(a): pass

class C:
    def foo(self, a): pass

class C:
    def __call__(self, a): pass

def two_arg(b, a): pass
foo4=lambda a: two_arg(0, a)

If I call them as fooN(), fooN(1), and fooN(1,2), the middle one works
and the other two throw exceptions, ergo they are one-argument
functions. The fact that two of them happen to be bound methods is an
implementation detail; it's just a form of currying, which foo4
happens also to be (in that C.foo takes two args, C().foo takes one).


More information about the Python-Dev mailing list