R. David Murray added the comment: OK, I didn't even realize that was possible with partial. Now I understand Yuri's original point. His example is wrong:
>>> def foo(a, b): ... print(a, b) >>> x2 = partial(foo, 'x') >>> str(inspect.signature(x2)) '(b)' This is the correct example: >>> x = partial(foo, a='x') >>> x('b') Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: foo() got multiple values for argument 'a' The current signature for this is the one Yuri gave: >>> str(inspect.signature(x)) "(a='x', b)" Which is about as close as one can come to the rather non-intuitve (non-pythonic?) behavior that partial has here. Perhaps this a bug in partial? If so it is unfortunately one with ugly backward compatibility implications. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21117> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com