Kaydet (Commit) f0195798 authored tarafından Lew Kurtz's avatar Lew Kurtz Kaydeden (comit) Gregory P. Smith

bpo-33460: remove ellipsis that look like continuation prompts (GH-7851)

Remove ellipsis that look like continuation prompts,
has a side benefit of putting rest of error message in proper text color.
üst 959625b5
...@@ -223,10 +223,14 @@ This only works with two literals though, not with variables or expressions:: ...@@ -223,10 +223,14 @@ This only works with two literals though, not with variables or expressions::
>>> prefix = 'Py' >>> prefix = 'Py'
>>> prefix 'thon' # can't concatenate a variable and a string literal >>> prefix 'thon' # can't concatenate a variable and a string literal
... File "<stdin>", line 1
prefix 'thon'
^
SyntaxError: invalid syntax SyntaxError: invalid syntax
>>> ('un' * 3) 'ium' >>> ('un' * 3) 'ium'
... File "<stdin>", line 1
('un' * 3) 'ium'
^
SyntaxError: invalid syntax SyntaxError: invalid syntax
If you want to concatenate variables or a variable and a literal, use ``+``:: If you want to concatenate variables or a variable and a literal, use ``+``::
...@@ -320,10 +324,12 @@ Python strings cannot be changed --- they are :term:`immutable`. ...@@ -320,10 +324,12 @@ Python strings cannot be changed --- they are :term:`immutable`.
Therefore, assigning to an indexed position in the string results in an error:: Therefore, assigning to an indexed position in the string results in an error::
>>> word[0] = 'J' >>> word[0] = 'J'
... Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'str' object does not support item assignment TypeError: 'str' object does not support item assignment
>>> word[2:] = 'py' >>> word[2:] = 'py'
... Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'str' object does not support item assignment TypeError: 'str' object does not support item assignment
If you need a different string, you should create a new one:: If you need a different string, you should create a new one::
......
replaced ellipsis with correct error codes in tutorial chapter 3.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment