On Tue, Jun 23, 2020 at 10:59 PM Rob Cliffe via Python-Dev < firstname.lastname@example.org> wrote:
I also (with others) prefer `else:` or perhaps `case else:` to using the`_` variable. The latter is obscure, and woudn't sit well with code that already uses that variable for its own purposes.
I think that's done for consistency. '_' is a wildcard and you can have:
case (_, _):
to match any 2-tuple, so:
would match any value, and can thus already serve as the default.
Consistency with what? Where else is `_` currently used as a wildcard?
Calling it a wildcard for the purposes of matching is more about using the terminology someone who wants to match a thing would search for. In other contexts it's called a throwaway, but it serves the exact same purpose. Calling it a throwaway would confuse people who don't know how language features are linked, but just know they want a catchall/wildcard.
I wonder if it's time to officially designate _ as a reserved name.