Description
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 of while 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:
==================================================
Traceback (most recent call last):
File "/home/pablogsal/github/python/main/check.py", line 18, in test_mistyped_program
exec(code_example)
~~~~^^^^^^^^^^^^^^
File "<string>", line 2
asynch def fetch_data():
^^^^^^
SyntaxError: invalid syntax. Did you mean 'async'?
==================================================
Traceback (most recent call last):
File "/home/pablogsal/github/python/main/check.py", line 18, in test_mistyped_program
exec(code_example)
~~~~^^^^^^^^^^^^^^
File "<string>", line 6
result = awaid fetch_data()
^^^^^
SyntaxError: invalid syntax. Did you mean 'await'?
==================================================
finally:
Traceback (most recent call last):
File "/home/pablogsal/github/python/main/check.py", line 18, in test_mistyped_program
exec(code_example)
~~~~^^^^^^^^^^^^^^
File "<string>", line 6
finaly:
^^^^^^
SyntaxError: invalid syntax. Did you mean 'finally'?
==================================================
Traceback (most recent call last):
File "/home/pablogsal/github/python/main/check.py", line 18, in test_mistyped_program
exec(code_example)
~~~~^^^^^^^^^^^^^^
File "<string>", line 4
raisee ValueError("Value cannot be negative")
^^^^^^
SyntaxError: invalid syntax. Did you mean 'raise'?
==================================================

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.
