A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-January/132088.html below:

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

[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:

[snip]

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.

--
~Ethan~
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4