gh-148327: Update syntax error example in tutorial#148328
gh-148327: Update syntax error example in tutorial#148328blesson-07 wants to merge 5 commits intopython:mainfrom
Conversation
Clarify error message explanation for syntax errors.
Fix formatting issues in error message example
|
CC @erlend-aasland, per #30097 (comment) |
sharktide
left a comment
There was a problem hiding this comment.
Looks good to me, left one wording suggestion. Up to you if you want to take it :)
| SyntaxError: unmatched ']' | ||
|
|
||
| The parser repeats the offending line and displays a little arrow pointing | ||
| at the earliest point in the line where the error was detected. |
There was a problem hiding this comment.
| at the earliest point in the line where the error was detected. | |
| at the earliest point in the line in which the error was detected. |
There was a problem hiding this comment.
"Where" seemed fine to me, but that's purely opinion.
|
I think I'm actually -1 here. First, what makes the example outdated? I get the following: >>> while True print('Hello world')
File "<python-input-0>", line 1
while True print('Hello world')
^^^^^
SyntaxError: invalid syntaxthat closely matches what the documentation currently has: >>> while True print('Hello world')
File "<stdin>", line 1
while True print('Hello world')
^^^^^
SyntaxError: invalid syntaxSo I'm not sure what the "outdated" here refers to. The "python-input-0" is maybe worth changing, but I don't think the while-loop stuff is. Second, I think the old example is clearer than the new one. The tutorial contains this paragraph:
The original while loop example is a deliberate choice to show the misleading arrow placement; it's useful to see that the arrows are at |
gh-148327: Update syntax error example in tutorial
Closes #148327
Replace the outdated syntax error example with a clearer one.
Update the syntax error example from
while True print('Hello world')toa[1]] = 0, which gives a clearerunmatched ']'error and better shows arrow placement.