On Mon, Apr 6, 2020 at 8:04 PM Guido van Rossum <guido@python.org> wrote:
On Mon, Apr 6, 2020 at 11:36 AM Steven D'Aprano <steve@pearwood.info> wrote:
Personally, I would not like to have to explain to newcomers why `match` is a keyword but you can still use it as a function or variable, but not other keywords like `raise`, `in`, `def` etc.
match expression: match = True
What kind of newcomers do you have that they even notice that, unless you were to draw attention to it? I'm serious -- from the kind of questions I've seen in user forums, most newcomers are having a hard enough time learning more fundamental concepts and abstractions than the precise rules for reserved words.
Absolutely. Beginners can simply be told they are keywords. If they then come across them in other contexts, hopefully there'll be a sensible documentation page that a web search for "<keyword> keyword" would lead to an explanation that "Some Python keywords can only ever be used with that meaning. Others can be used with other meanings where the context makes it clear that the keyword interpretation does not apply. You are recommended not to use such keywords as names in your own programs. The feature was implemented to make porting existing code to future versions of Python simpler." The tutorial should contain a similar passage.