On Mon, Nov 1, 2021 at 7:39 PM Evpok Padding <evpok.padd...@gmail.com> wrote:
>
> I definitely agree with that sentiment, with beginners I don't even talk 
> about function defaults at first, and when I do, it's when we have already 
> have a talk about mutables so I can just say that you almost never want a 
> mutable default but rather use None as a sentinel. It's not that hard and it 
> serves as a reminder of how mutables work, so it's actually good for teaching!
>

Or you can just say "but rather use => when defining the default", and
then you don't have to explain more things like whether to use "==
None" or "is None" just to show how to have a default that builds a
new thing.

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

Reply via email to