-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Improve syntax error messages for keywords with typos #132449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The implementation of my draft PR adds a keyword typo detection and suggestion mechanism to Python's syntax error handling:
|
Signed-off-by: Pablo Galindo <[email protected]>
Signed-off-by: Pablo Galindo <[email protected]>
@lysnikolaou what do you think of this approach? |
Signed-off-by: Pablo Galindo <[email protected]>
Signed-off-by: Pablo Galindo <[email protected]>
…2450) Signed-off-by: Pablo Galindo <[email protected]> Co-authored-by: Łukasz Langa <[email protected]>
Signed-off-by: Pablo Galindo <[email protected]>
Currently, when users make typos in Python keywords, they receive generic "invalid syntax" error messages without any helpful suggestions about what might be wrong. This creates a frustrating experience, especially for beginners who might not immediately recognize that they've misspelled a keyword.
For example, typing
whille True:
instead ofwhile True:
would currently result in a generic syntax error without any hint that the problem is a misspelled keyword.I propose to start raising errors like these:
Linked PRs
The text was updated successfully, but these errors were encountered: