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

Anders J. Munch 2013 at jmunch.dk
Sat Jan 25 12:34:06 CET 2014
Larry Hastings wrote:
>
> inspect.signature gets this right:
>
>     >>> import inspect
>     >>> str(inspect.signature(c.foo))
>     '(a)'
>

Not always.

: Python 3.4.0b2+ (default:32f9e0ae23f7, Jan 18 2014, 13:56:31)
: [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
: Type "help", "copyright", "credits" or "license" for more information.
: >>> import inspect
: >>> class C1:
: ...     def f(*args, **kwargs): pass
: ...
: >>> c = C1()
: >>> c.f()
: >>> str(inspect.signature(c.f))
: '(**kwargs)'

Not to mention:
class C2:
    def g(**kwargs): pass

It doesn't really make sense - calling C2().g is guaranteed to fail - but it's 
legal Python.

I'm not saying you can't special-case a few things and fix this, but still, 
-1/B.  I like explicit self.

regards, Anders



More information about the Python-Dev mailing list