Taking a step back:
Suppose Python didn't have default values AT ALL for function
parameters? Say that unpassed parameters were always set to some
sentinel value (maybe None, maybe some special value NotPassed). Would
we want to add them to the language?
Surely almost everybody would say yes. (I can't believe anyone would be
happy with removing them now.)
Then there would be a discussion about whether the defaults should be
calculated only once (i.e. early-bound) or on every function call (i.e.
late-bound).
Historically the decision was made to make them early-bound. I don't
how that decision was arrived at, it was before my (Python) time.
But consider this: AFAICS, **everything* you can do with early binding,
you can do with late binding, but *not* vice versa*. (To simulate early
binding if you actually only have late binding, simply put the default
value in a global variable which you never change, and use that global
variable as your default value. As is commonly done today.)
So PEP 671 merely attempts to restore functionality that was
(regrettably IMO) left out as a result of that early decision.
Best wishes
Rob Cliffe
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/YSOPBDJUNYK7B6NOEMOG2RN3N3KWP7TT/
Code of Conduct: http://python.org/psf/codeofconduct/