Terry J. Reedy <tjre...@udel.edu> added the comment:
Bound is created with 5 public attributes: >>> dir(bound) [..., 'apply_defaults', 'args', 'arguments', 'kwargs', 'signature'] >>> bound.args () >>> bound.arguments {} >>> bound.kwargs {} msg376578: I don't understand 'non-existent' arguments, Nor 'what happened...print... ignored' as there is no previous print. msg376590: Given " Changes in arguments will reflect in args and kwargs.", I agree that changes to 'arguments' *apparently* not being reflected in 'args' and 'kwargs' is initally a bit puzzling . >>> bound.kwargs == bound.arguments True >>> bound.arguments['something'] = 'guess' >>> bound.kwargs {} >>> bound.arguments {'something': 'guess'} However, your 'two' function takes no arguments, so valid values of args and kwargs must be empty for them to be used in a call. In all cases, args() and kwargs() must look at the signature to see which key-value pairs they should extract from arguments. >>> def f(a): pass >>> signature(f).bind() # Must pass value arguments Traceback (most recent call last): ... TypeError: missing a required argument: 'a' >>> b = signature(f).bind(3) >>> b.arguments {'a': 3} >>> b.args (3,) # Because 'a' is positional. >>> b.kwargs {} # Because 'a' is not keyword only. >>> b.arguments['a']=5 >>> b.args (5,) # Legitimate change reflected here. Perhaps the doc could be improved, but I have no particular suggestion. ---------- assignee: -> docs@python components: +Documentation -Library (Lib) nosy: +docs@python, terry.reedy _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41745> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com