Author Julian
Recipients Julian, yselivanov
Date 2020-09-08.19:23:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1599593006.89.0.816409373828.issue41745@roundup.psfhosted.org>
In-reply-to
Content
As a secondary behavior here, which is actually the one that matters more for my use case, the following seems surprising as well:

import inspect
s = inspect.signature(lambda **kwargs: kwargs).bind()
s.arguments["foo"] = 12

will similarly silently drop "foo" when attempting to call the function (i.e. it will not appear in bound.kwargs).

This behavior I suspect is the intention of the docs saying "Contains only explicitly bound arguments." but still seems easily misused when .arguments is being used as a frontend for adding additional arguments.

To me just brainstorming again it seems it'd be useful to provide a harder-to-misuse frontend, e.g. `BoundArguments.with_arguments(*args, **kwargs)` that returns a bound arguments with some additional to-be-bound arguments which may end up in `kwargs`.
History
Date User Action Args
2020-09-08 19:23:26Juliansetrecipients: + Julian, yselivanov
2020-09-08 19:23:26Juliansetmessageid: <1599593006.89.0.816409373828.issue41745@roundup.psfhosted.org>
2020-09-08 19:23:26Julianlinkissue41745 messages
2020-09-08 19:23:26Juliancreate