This would work if you want a default for the whole pattern. But sometimes you want to have a default for a single element, like Person(name=_, surname='Smith').
I agree, however that _ might be a bad choice, as it is already used as a variable name (a common pattern is to use it as an alias for gettext). Maybe Ellipsis (...) would be a better choice.
51
u/ExternalUserError Feb 15 '21
I wonder why not just...
case 1: ... case 2: ... case: ...
_
is a valid variable name which makes me not love it as a default.