[Python-ideas] Re: PEP 671 late-bound defaults implementation

2021-10-31 Thread Chris Angelico
On Sun, Oct 31, 2021 at 6:25 PM Steven D'Aprano wrote: > > I have a suggestion for the implementation. > > I think that Chris' current approach is to compile the late-bound > defaults in the function body. So if we have a function like this: > > def func(a, b=early_expression, @c=late_expressi

[Python-ideas] Re: PEP 671 late-bound defaults implementation

2021-10-31 Thread Steven D'Aprano
On Sun, Oct 31, 2021 at 06:22:09PM +1100, Steven D'Aprano wrote: [snip] > Benefits: If I have understood Chris correctly, there's another benefit. Replacing the late bound defaults in the function object will no longer be a misleading no-op that confuses introspection tools such as inspect.sig