On 4/23/22 12:11, Christopher Barker wrote:
> NOTE: another key question for this proposal is how you would handle mutable
defaults -- anything
> special, or "don't do that"?
Why should they be handled at all? If the programmer writes
def __init__(a, @b, @c=[]):
pass
then all instances that didn't have `c` given will share the same list -- just
like if the code was:
def __init__(a, b, c=[]):
self.b = b
self.c = c
The purpose of the syntax is to automatically save arguments to same-named
attributes, not to perform any other magic.
--
~Ethan~
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/HXQ6K6RF5AZ7XLNWRXGSNKN4KOIYZZ7E/
Code of Conduct: http://python.org/psf/codeofconduct/