Feature or enhancement
Proposal:
Right now using a non-case statement inside a match block gives a rather opaque syntax error:
match a:
case 1:
pass
if 2:
pass
gives:
File "<python-input-0>", line 4
if 2:
^^
SyntaxError: invalid syntax
It's easy to accidentally write something like this when dedenting code too much inside a case block or when not dedenting code enough after the match block.
I propose a specialized syntax error that more clearly points out what the problem is:
SyntaxError: expected 'case' statement inside 'match' statement
PR forthcoming
cc @pablogsal @lysnikolaou
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
Feature or enhancement
Proposal:
Right now using a non-
casestatement inside amatchblock gives a rather opaque syntax error:gives:
It's easy to accidentally write something like this when dedenting code too much inside a case block or when not dedenting code enough after the match block.
I propose a specialized syntax error that more clearly points out what the problem is:
PR forthcoming
cc @pablogsal @lysnikolaou
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
casestatement insidematchstatement #146583