News for hackers. Stuff that matters.
Re:Upcoming Python features brought to you by Python Enhance... by klickverbot on Monday February 14, 2022 @10:16AM (#30332977)
There isn't anything special about functions; the original article does not describe this correctly. Rather, the big conceptual difference is the point at which the expression is evaluated – once for the whole program (`=`), vs. at each call site (`=>`).

I presume this got accepted because it fixes a well-known gotcha with default parameters in Python due to early evaluation, where, for instance, the dictionary instance in `def fun(args={}): …` would be shared between all invocations, leading to all sorts of fun bugs. This is especially pernicious as most Python programmers will know other languages as well, where this tends to be handled much more sensibly (e.g. in C++, D, …) and default arguments are evaluated at each call site.

Re:Upcoming Python features brought to you by Python Enhance... by cuteboy19 on Monday February 14, 2022 @11:25AM (#30333916)
I think this could have been fixed by always evaluating default args on each invocation. There is no reason why a default arg of all things should carry any mutable state. The people who would complain probably already had bugs in their code