
On Wed, 27 Jul 2022 at 22:54, Mathew Elman <mathew.elman@ocado.com> wrote:
Chris Angelico wrote:
Again, I am not pro this idea, just answering the questions you're asking as I see them :) Yeah. I think you're doing a great job of showing why this is a bad idea :)
I do think the desire to fix the "wrapper not needing to know the defaults of wrapped" problem is admirable. Is this the right approach? No, I think not.
Wrapper not needing to know the defaults of the wrapped can be solved with *a,**kw. This modifies the problem into "callers of the wrapper now don't know anything about the signature". I'd rather look into ways of solving that problem instead - ways of taking a function signature, making specific changes to it (usually adding and/or removing args, but maybe other changes), and then making that your declared signature. At the moment, it's only possible to copy a signature as is (with functools.wraps() and equivalents). ChrisA