diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2016-09-30 19:39:22 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2016-09-30 19:39:22 (GMT) |
commit | 36925001e6d9290b000722ad2a6ea86dbc27ea09 (patch) | |
tree | 5aee84cb2946110ddaa50a48c21c90a263f28e56 /Doc | |
parent | 1c3e75fea70bdd40113b56ae6706aa90f4e15397 (diff) | |
parent | b4b55eb582e5a7c71bac90030ab3c46b5cd6d429 (diff) | |
download | cpython-36925001e6d9290b000722ad2a6ea86dbc27ea09.zip cpython-36925001e6d9290b000722ad2a6ea86dbc27ea09.tar.gz cpython-36925001e6d9290b000722ad2a6ea86dbc27ea09.tar.bz2 |
Merge with 3.6
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/tutorial/errors.rst | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index 6911ce9..291fb4d 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -18,7 +18,7 @@ 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') - File "<stdin>", line 1, in ? + File "<stdin>", line 1 while True print('Hello world') ^ SyntaxError: invalid syntax @@ -44,15 +44,15 @@ programs, however, and result in error messages as shown here:: >>> 10 * (1/0) Traceback (most recent call last): - File "<stdin>", line 1, in ? + File "<stdin>", line 1, in <module> ZeroDivisionError: division by zero >>> 4 + spam*3 Traceback (most recent call last): - File "<stdin>", line 1, in ? + File "<stdin>", line 1, in <module> NameError: name 'spam' is not defined >>> '2' + 2 Traceback (most recent call last): - File "<stdin>", line 1, in ? + File "<stdin>", line 1, in <module> TypeError: Can't convert 'int' object to str implicitly The last line of the error message indicates what happened. Exceptions come in @@ -214,7 +214,7 @@ exception to occur. For example:: >>> raise NameError('HiThere') Traceback (most recent call last): - File "<stdin>", line 1, in ? + File "<stdin>", line 1, in <module> NameError: HiThere The sole argument to :keyword:`raise` indicates the exception to be raised. @@ -233,7 +233,7 @@ re-raise the exception:: ... An exception flew by! Traceback (most recent call last): - File "<stdin>", line 2, in ? + File "<stdin>", line 2, in <module> NameError: HiThere @@ -308,7 +308,7 @@ example:: ... Goodbye, world! Traceback (most recent call last): - File "<stdin>", line 2, in ? + File "<stdin>", line 2, in <module> KeyboardInterrupt A *finally clause* is always executed before leaving the :keyword:`try` @@ -340,7 +340,7 @@ complicated example:: >>> divide("2", "1") executing finally clause Traceback (most recent call last): - File "<stdin>", line 1, in ? + File "<stdin>", line 1, in <module> File "<stdin>", line 3, in divide TypeError: unsupported operand type(s) for /: 'str' and 'str' |