On 29/05/20 12:17 am, Richard Damon wrote:
But default values for arguments are really part of the responsibility
for the caller, not the called function. The classic implementation
would be that the caller passes all of the explicitly,

I would say that's really a less-than-ideal implementation,
that has the consequence of requiring information to be put
in the header that doesn't strictly belong there.

To my mind, the signature consists of information that a
static type checker would need to verify that a call is valid.
That does not include default values of arguments. The fact
that a particular value is substituted if an argument is
omitted is part of the behaviour of the function, not part
of its signature.

By putting default values in the header, we're including a
tiny bit of behavioural information. By distinguishing between
one-time and per-call evaluation of defaults, we're adding a
bit more behavioural information.

Where do we draw the line? How much of the behaviour of the
function do we want to move into the header?

--
Greg
_______________________________________________
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/E6VPNSTZXB7UCUOUHGVD7W57HF6L6A2R/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to