Terry J. Reedy added the comment: What matters to other programs is what the inspect functions return, not what help() does or does not do to the returned string before displaying it. So I see the issue as the discrepancy in this.
class C: def foo(self, a): pass c = C() import inspect print('garg - C.foo ', inspect.formatargspec(*inspect.getfullargspec(C.foo))) print('garg - c.foo', inspect.formatargspec(*inspect.getfullargspec(c.foo))) print('sig - C.foo ', str(inspect.signature(C.foo))) print('sig - c.foo', str(inspect.signature(c.foo))) >>> garg - C.foo (self, a) garg - c.foo (self, a) sig - C.foo (self, a) sig - c.foo (a) Idle calltips attempt to remind the user what they must and might enter after '('. For this, the sig output correct and the garg output is buggy. Idle currently works around the garg bug by selectively deleting the first param name with if (isinstance(ob, (type, types.MethodType)) or isinstance(ob_call, types.MethodType)): argspec = _first_param.sub("", argspec) If signatures for bound builtins are similarly buggy, by including 'self' when it should be omitted, calltips would need a means to detect when to omit. Perhaps >>> type([].append) <class 'builtin_function_or_method'> will work, but the name implies otherwise. In any case, I would prefer that inspect.signature give correct results instead of being made bug-compatible with .getfullargspec. In other words, it should include the 'delete self' code that is correct for the implementation. Then I could omit the yet-to-be-written expanded workaround. I regard this help output as buggy. >>> help(c.foo) Help on method foo in module __main__: foo(self, a) method of __main__.C instance It identifies foo as a bound method, but gives the wrong signature for a bound method. So in my view, your changes fix a bug rather than breaking correct behavior. ---------- nosy: +terry.reedy _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20379> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com