Skip to content

Commit 3e45030

Browse files
authored
gh-116563: Update tutorial error example (#116569)
There now may be multiple carets pointing at a token rather than just a character. Fix the sentence about possible causes.
1 parent 44f9a84 commit 3e45030

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/tutorial/errors.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ complaint you get while you are still learning Python::
2020
>>> while True print('Hello world')
2121
File "<stdin>", line 1
2222
while True print('Hello world')
23-
^
23+
^^^^^
2424
SyntaxError: invalid syntax
2525

26-
The parser repeats the offending line and displays a little 'arrow' pointing at
27-
the earliest point in the line where the error was detected. The error is
28-
caused by (or at least detected at) the token *preceding* the arrow: in the
26+
The parser repeats the offending line and displays little 'arrow's pointing
27+
at the token in the line where the error was detected. The error may be
28+
caused by the absence of a token *before* the indicated token. In the
2929
example, the error is detected at the function :func:`print`, since a colon
3030
(``':'``) is missing before it. File name and line number are printed so you
3131
know where to look in case the input came from a script.

0 commit comments

Comments
 (0)