diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index 3c6edf2c4793ab..15eba6ba4e4ab0 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -17,16 +17,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') + >>> a[1]] = 0 File "", line 1 - while True print('Hello world') - ^^^^^ - SyntaxError: invalid syntax - -The parser repeats the offending line and displays little arrows pointing -at the place where the error was detected. Note that this is not always the -place that needs to be fixed. In the example, the error is detected at the -function :func:`print`, since a colon (``':'``) is missing just before it. + a[1]] = 0 + ^ + 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. +Note that this is not always the place that needs to be fixed. +In the example, the arrow points to the extra ``]`` bracket, which is where the +error is detected. The file name (```` in our example) and line number are printed so you know where to look in case the input came from a file.