[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2022-12-25 Thread Shironeko
Is the => syntax needed? as far as I can think of, the only time where late evaluation is needed is when the expression references the other arguments. So the rule “if the expression reference other arguments it will get evaluated at function call time” should suffice right? In effect: def

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2022-12-25 Thread Steven D'Aprano
On Sat, Dec 24, 2022 at 11:34:19AM -0500, Shironeko wrote: > > Is the => syntax needed? as far as I can think of, the only time where > late evaluation is needed is when the expression references the other > arguments. You are missing the most common case, the motivating case, for late-bound d

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2022-12-25 Thread Chris Angelico
On Mon, 26 Dec 2022 at 04:53, Steven D'Aprano wrote: > > On Sat, Dec 24, 2022 at 11:34:19AM -0500, Shironeko wrote: > > > > Is the => syntax needed? as far as I can think of, the only time where > > late evaluation is needed is when the expression references the other > > arguments. > > You are mi

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2022-12-25 Thread shironeko . python
I didn't realize def foo(x, y=[]) had this strange artifact but it totally makes sense, TIL. I did not get the right idea reading the PEP though, since currently the motivation reads: > Optional function arguments, if omitted, often have some sort of logical > default value. When this value dep

[Python-ideas] Re: PEP 671 (late-bound arg defaults), next round of discussion!

2022-12-25 Thread Chris Angelico
On Mon, 26 Dec 2022 at 10:02, wrote: > > I didn't realize def foo(x, y=[]) had this strange artifact but it totally > makes sense, TIL. I did not get the right idea reading the PEP though, since > currently the motivation reads: > > > Optional function arguments, if omitted, often have some sort