mirror of https://github.com/python/cpython
Issue #28815: Change '?' to '<module>' in some doc examples.
Patch by Mariatta Wijaya.
This commit is contained in:
parent
e3c65a7a22
commit
30eee4deec
|
@ -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::
|
complaint you get while you are still learning Python::
|
||||||
|
|
||||||
>>> while True print('Hello world')
|
>>> while True print('Hello world')
|
||||||
File "<stdin>", line 1, in ?
|
File "<stdin>", line 1
|
||||||
while True print('Hello world')
|
while True print('Hello world')
|
||||||
^
|
^
|
||||||
SyntaxError: invalid syntax
|
SyntaxError: invalid syntax
|
||||||
|
@ -44,15 +44,15 @@ programs, however, and result in error messages as shown here::
|
||||||
|
|
||||||
>>> 10 * (1/0)
|
>>> 10 * (1/0)
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
File "<stdin>", line 1, in ?
|
File "<stdin>", line 1, in <module>
|
||||||
ZeroDivisionError: division by zero
|
ZeroDivisionError: division by zero
|
||||||
>>> 4 + spam*3
|
>>> 4 + spam*3
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
File "<stdin>", line 1, in ?
|
File "<stdin>", line 1, in <module>
|
||||||
NameError: name 'spam' is not defined
|
NameError: name 'spam' is not defined
|
||||||
>>> '2' + 2
|
>>> '2' + 2
|
||||||
Traceback (most recent call last):
|
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
|
TypeError: Can't convert 'int' object to str implicitly
|
||||||
|
|
||||||
The last line of the error message indicates what happened. Exceptions come in
|
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')
|
>>> raise NameError('HiThere')
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
File "<stdin>", line 1, in ?
|
File "<stdin>", line 1, in <module>
|
||||||
NameError: HiThere
|
NameError: HiThere
|
||||||
|
|
||||||
The sole argument to :keyword:`raise` indicates the exception to be raised.
|
The sole argument to :keyword:`raise` indicates the exception to be raised.
|
||||||
|
@ -233,7 +233,7 @@ re-raise the exception::
|
||||||
...
|
...
|
||||||
An exception flew by!
|
An exception flew by!
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
File "<stdin>", line 2, in ?
|
File "<stdin>", line 2, in <module>
|
||||||
NameError: HiThere
|
NameError: HiThere
|
||||||
|
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ example::
|
||||||
...
|
...
|
||||||
Goodbye, world!
|
Goodbye, world!
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
File "<stdin>", line 2, in ?
|
File "<stdin>", line 2, in <module>
|
||||||
KeyboardInterrupt
|
KeyboardInterrupt
|
||||||
|
|
||||||
A *finally clause* is always executed before leaving the :keyword:`try`
|
A *finally clause* is always executed before leaving the :keyword:`try`
|
||||||
|
@ -340,7 +340,7 @@ complicated example::
|
||||||
>>> divide("2", "1")
|
>>> divide("2", "1")
|
||||||
executing finally clause
|
executing finally clause
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
File "<stdin>", line 1, in ?
|
File "<stdin>", line 1, in <module>
|
||||||
File "<stdin>", line 3, in divide
|
File "<stdin>", line 3, in divide
|
||||||
TypeError: unsupported operand type(s) for /: 'str' and 'str'
|
TypeError: unsupported operand type(s) for /: 'str' and 'str'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue