On 2021-10-25 18:56, Steven D'Aprano wrote:
Modifying the assignment symbol is wrong. This is not a new kind of
assignment, it should use the same `=` regular assignment. We are
tagging the parameter to use late-binding, not using a different sort of
assignment. The tag should be on the parameter name, not the assignment.
I agree with half of this :-). I agree that it's not a new kind of
assignment. But I don't think we're tagging the parameter to use late
binding. We're tagging the default value itself to not be evaluated
right now (i.e., at function definition time) but later (at call time).
To me this is another thing that suggests a more general
deferred-evaluation system is the best way to handle this. If we're
tagging the parameter to not be evaluated "right now", why must we
restrict "right now" to be "the time when we're defining a function" and
restrict this to apply to function parameters rather than, well,
anything? Why not just say we can tag stuff as not being evaluated
right now and then later evaluate it?
--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no
path, and leave a trail."
--author unknown
_______________________________________________
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/2T4NCETN3PLAZX35DSVDCUNAMSELEGJR/
Code of Conduct: http://python.org/psf/codeofconduct/