
On Mon, Oct 25, 2021 at 6:13 PM Steven D'Aprano <steve@pearwood.info> wrote:
On Mon, Oct 25, 2021 at 05:23:38AM +1100, Chris Angelico wrote:
On Mon, Oct 25, 2021 at 4:29 AM Erik Demaine <edemaine@mit.edu> wrote:
On Sun, 24 Oct 2021, Erik Demaine wrote:
I think the semantics are easy to specify: the argument defaults get evaluated for unspecified order, in left to right order as specified in the def. Those may trigger exceptions as usual.
Sorry, that should be:
I think the semantics are easy to specify: the argument defaults get evaluated for unspecified ARGUMENT(s), in left to right order as specified in the def. Those may trigger exceptions as usual.
Ah, but is it ALL argument defaults, or only those that are late-evaluated? Either way, it's going to be inconsistent with itself and harder to explain. That's what led me to change my mind.
The rules for applying parameter defaults are well-defined. I would have to look it up to be sure...
And that right there is all the evidence I need. If you, an experienced Python programmer, can be unsure, then there's a strong indication that novice programmers will have far more trouble. Why permit bad code at the price of hard-to-explain complexity? Offer me a real use-case where this would matter. So far, we had better use-cases for arbitrary assignment expression targets than for back-to-front argument default references, and those were excluded. ChrisA