-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Fix the output of syntax error example #30097
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
Changes from all commits
722eafd
dc91d80
bd6d05a
55ebf2d
ab47e74
f91d022
149c7eb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -16,18 +16,17 @@ Syntax Errors | |||
|
|
||||
| Syntax errors, also known as parsing errors, are perhaps the most common kind of | ||||
| complaint you get while you are still learning Python:: | ||||
|
|
||||
| >>> while True print('Hello world') | ||||
| >>> print('Are you suggesting that coconuts migrate?) | ||||
| File "<stdin>", line 1 | ||||
| while True print('Hello world') | ||||
| ^ | ||||
| SyntaxError: invalid syntax | ||||
|
|
||||
| print('Are you suggesting that coconuts migrate?) | ||||
| ^ | ||||
|
Comment on lines
+21
to
+22
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The caret is not aligned with the first quote? |
||||
| SyntaxError: unterminated string literal (detected at line 1) | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Spurious whitespace |
||||
| The parser repeats the offending line and displays a little 'arrow' pointing at | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This no longer matches the example.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @iritkatriel - just checking if you need anything from my side ??
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sentence just after the example looks like it needs to be updated as well.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've updated the sentence as requested - let me know if it looks good to you ?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The sentence below is now incorrect, it talks about a missing colon before
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ^ This is still the case, requesting changes to make sure this is not missed. |
||||
| the earliest point in the line where the error was detected. The error is | ||||
| caused by (or at least detected at) the token *preceding* the arrow: in the | ||||
| example, the error is detected at the function :func:`print`, since a colon | ||||
| (``':'``) is missing before it. File name and line number are printed so you | ||||
| example, the error is detected at the function :func:`print`, since a single quote | ||||
| (``'``) is missing. Error message and line number is also printed so you | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you change it to "Error message," the old sentence is perfectly fine? |
||||
| know where to look in case the input came from a script. | ||||
|
|
||||
|
|
||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that not standard for the new repl?