
Oct. 25, 2021
1:59 p.m.
On 25 Oct 2021, at 08:08, Steven D'Aprano <steve@pearwood.info> wrote:
I would say that it makes most sense to assign early-bound defaults first, then late-bound defaults, specifically so that late-bound defaults can refer to early-bound ones:
def func(x=0, @y=x+1)
So step 3 above should become:
In this case you do not need a new rule to make it work as in the left-to-right order x = 0 first. def func(@y=x+1, @x=0): Is it unreasonable to get a UnboundLocal or SyntaxError for this case? I'm not convinced that extra rules are needed. Barry