As you may know, match-case statements are an easy way to run stuff in a clean and orderly way.
But why are they not highlighted in a special color like normal keywords are? In fact, they are the only soft keywords Python has.
My proposal is that they are made into the keywords that are highlighted like others and that soft keywords are removed entirely; so that new Python learners are not confused by ‘match’ and ‘case’ not being highlighted.
Thank you.
(And if it turns out soft keywords ARE necessary in Python, I will take my words back.)
If they became real keywords, then existing code that uses them as identifiers would break. That’s not acceptable, and it’s why they were made soft keywords in the first place.
Syntax highlighting is a different issue. Maybe it’s possible to highlight them when they’re acting as keywords.
It’s able to recognize when match and case are being used as names, and when they’re being used as keywords, and colorizes them accordingly. I’d say this is something to file as a bug report for your editor/environment rather than change the language.
match and case are not the only soft keywords. _ may also be one in a case statement. lazy now is too. IDLE also matches them when appropriate except in a few rare cases.