Skip to content

Commit

Permalink
gh-116563: Update tutorial error example (#116569)
Browse files Browse the repository at this point in the history
There now may be multiple carets pointing at a token
rather than just a character.  Fix the sentence about
possible causes.
  • Loading branch information
terryjreedy authored Mar 11, 2024
1 parent 44f9a84 commit 3e45030
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Doc/tutorial/errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ complaint you get while you are still learning Python::
>>> while True print('Hello world')
File "<stdin>", line 1
while True print('Hello world')
^
^^^^^
SyntaxError: invalid syntax

The parser repeats the offending line and displays a little 'arrow' pointing at
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
The parser repeats the offending line and displays little 'arrow's pointing
at the token in the line where the error was detected. The error may be
caused by the absence of a token *before* the indicated token. 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
know where to look in case the input came from a script.
Expand Down

0 comments on commit 3e45030

Please sign in to comment.