
Nov. 1, 2021
10:42 a.m.
On Mon, Nov 1, 2021 at 7:39 PM Evpok Padding <evpok.padding@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