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

Ethan Furman ethan at stoneleaf.us
Sun Jan 26 02:24:20 CET 2014

On 01/25/2014 04:34 AM, Chris Angelico wrote:
> 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.
> Vote for A. As far as I'm concerned, all these foo are equally
> callable and equally take one parameter named a:


To strengthen this argument:

--> import inspect
--> from functools import partial
--> def lots_of_args(a, b, c, d=3, e='wow', f=None):
...    print(a, b, c, d, e, f)
--> str(inspect.signature(lots_of_args))
"(a, b, c, d=3, e='wow', f=None)"

--> curried = partial(lots_of_args, 9, f='Some')
--> str(inspect.signature(curried))
"(b, c, d=3, e='wow', f='Some')"

While I partially agree with Antoine that the whole self thing is confusing, I think it would be more accurate to only 
give help (and a signature) on parameters that you can actually change; if you are calling a bound method there is no 
way to pass in something else in place of self.

So I vote for A.


More information about the Python-Dev mailing list