Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions Doc/tutorial/errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
File "<stdin>", line 1
File "<python-input-0>", line 1

Is that not standard for the new repl?

while True print('Hello world')
^
SyntaxError: invalid syntax

print('Are you suggesting that coconuts migrate?)
^
Comment on lines +21 to +22
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This no longer matches the example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @iritkatriel - just checking if you need anything from my side ??

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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 ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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 print.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.


Expand Down