
Sorry for top posting: I’m on the road. inspect.signature can help with this. -- Eric
On Jul 27, 2022, at 9:22 AM, Chris Angelico <rosuav@gmail.com> wrote:
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 _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/66RPVN... Code of Conduct: http://python.org/psf/codeofconduct/