On Wed, Nov 18, 2020 at 11:39 AM Brett Cannon <brett@python.org> wrote:
My question about adding pattern matching later was more to comment on the fact that the languages that use "_" for a wildcard pattern did it from early on, not later on; it had nothing to do with the proposal proposing pattern matching late in Python's history.
I suspect that historically there is a connection here; we used "_" in Python for a number of special purposes because it's defined to be an identifier by the lexer but not likely to be used as a "regular" identifier, being kind of an edge case. Like Python, many other languages inherited this from C, with its definition of identifiers as "letter (letter|digit)*" where "_" is considered a letter. Also, in Scala its usage in patterns is similarly different from the rest of the language; there, too, it is a normal variable name except in patterns. PS. Why do you think that this is "late in Python's history?" In 100 years people will chuckle about that. :-) -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>