gh-138857: Improve error message for case outside of match#138858
gh-138857: Improve error message for case outside of match#138858lysnikolaou merged 5 commits intopython:mainfrom
case outside of match#138858Conversation
There was a problem hiding this comment.
I am fine with this but I wonder how often people may fall into this... I don't think is a bad idea I cannot see anything wrong with the grammar since the short circuit is NAME + NAME. Does this trigger for case match: (afk atm so I cannot check myselef) ?
|
@pablogsal here's the result :) |
I always try to report parsing problems from errors that I make myself that make me scratch my head. Today I wrote this code while reviewing this PR: wemake-services/wemake-python-styleguide#3526 case some: # <- should be `match`
case other: ...and I was like: what's wrong? Why is there a syntax error? It was not easy to mention, especially given that some languages like |
Sold! Ok, let's get it in I think is a good idea. I was tempted to suggest getting: as "maybe you mean match" but that's going to be a can of worms |
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
pablogsal
left a comment
There was a problem hiding this comment.
LGTM
Wait some days for @lysnikolaou to take a look before landing
|
|
|
…ython#138858) * pythongh-138857: Improve error message for `case` outside of `match` --------- Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>

Preview:
What do you think? :)
case 1:statement #138857