PEP 634 says that "The match and case keywords are soft keywords, i.e. they are not reserved words in other grammatical contexts (including at the start of a line if there is no colon where expected). This implies that they are recognized as keywords when part of a match statement or case block only, and are allowed to be used in all other contexts as variable or argument names."
Also referring the docs "Some identifiers are only reserved under specific contexts. These are known as soft keywords. The identifiers match, case and _ can syntactically act as keywords in contexts related to the pattern matching statement, but this distinction is done at the parser level, not when tokenizing."
I dont seem to get around this specific statement clearly."This implies that they are recognized as keywords when part of a match statement or case block only" Isnt this supposed to mean that when we write something like the below code,it should be wrong?:
def match_case_func(match):
"""Function docstring"""
case = "dont quit"
match match:
case "bye" | "quit":
case = 1
print("Quitting")
case case:
print("Probably not quitting")