On 2021-10-31 05:57, Chris Angelico wrote:
Deferred expressions are not the same as late-bound argument defaults.
You keep saying this, but I still don't get the point. Descriptors are
not the same as properties, but we can implement properties with
descriptors. Decorators are not the same as callables, but we can
implement decorators with callables. The plus sign is not the same as
an __add__ method, but we can define the implementation of + in terms of
__add__ (and __radd__) methods on objects.
As far as I can tell the only real difference is that you seem very
intent on the idea that the default argument is ONLY evaluated right at
the beginning of the function and not later. But so what? A general
deferred expression would still allow you to do that, it would just also
allow you to evaluate the deferred expression at some other point. That
might be useful or it might not, but I don't see how it prevents a
deferred object from serving the function of a late-bound default. The
question isn't whether deferred objects and late-bound defaults "are the
same", but whether one can provide a more general framework within which
the other can be expressed.
--
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/5QNRQHDESCJGP54OF6CYPSTE7DPNRE3H/
Code of Conduct: http://python.org/psf/codeofconduct/