Special syntax error for elif
after else
#129858
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
topic-parser
type-feature
A feature request or enhancement
Feature or enhancement
Proposal:
I've implemented a special syntax error in the case that an
elif
follows anelse
. See here.This is currently the extent of the new behavior. If possible, I would be interested to implement behavior like this:
This would be even more informative for beginners, but I'm not sure if the parser supports that level of state. In particular, we wouldn't want the latter syntax error (the one that suggests that the indentation level is wrong) to be raised if the invalid elif were within a for block.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
elif
block afterelse
#129902The text was updated successfully, but these errors were encountered: