3 ms·
I believe the former is more idiomatic, but I don't have a reference. You want to explicitly check against `None` so that you're not overwriting all falsey val
by CognitiveLens 12y ago
I believe the former is more idiomatic, but I don't have a reference.
You want to explicitly check against `None` so that you're not overwriting all falsey values of `val` - even though you should generally try to enforce argument types, your second example would cause unexpected behavior in some cases, particularly those that have non-falsey 'default' assignments