[Python-Dev] Quick poll: should help() show bound arguments? (original) (raw)
Chris Angelico rosuav at gmail.com
Sat Jan 25 13:34:47 CET 2014
- Previous message: [Python-Dev] Quick poll: should help() show bound arguments?
- Next message: [Python-Dev] Quick poll: should help() show bound arguments?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 foo2=C().foo
class C: def call(self, a): pass foo3=C()
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).
ChrisA
- Previous message: [Python-Dev] Quick poll: should help() show bound arguments?
- Next message: [Python-Dev] Quick poll: should help() show bound arguments?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]