Skip to content

Commit 5ab99d5

Browse files
Damien-Chenblhsing
authored andcommitted
pythongh-122944: Fix incorrect prompt strings in the Python Tutorial (python#122949)
In the REPL, top level comments are followed by a primary, not secondary prompt. Fix the places in the in the tutorial that use the latter.
1 parent 0500cf9 commit 5ab99d5

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

Doc/tutorial/controlflow.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ they appear in the sequence. For example (no pun intended):
6161
::
6262

6363
>>> # Measure some strings:
64-
... words = ['cat', 'window', 'defenestrate']
64+
>>> words = ['cat', 'window', 'defenestrate']
6565
>>> for w in words:
6666
... print(w, len(w))
6767
...
@@ -445,7 +445,7 @@ boundary::
445445
... print()
446446
...
447447
>>> # Now call the function we just defined:
448-
... fib(2000)
448+
>>> fib(2000)
449449
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597
450450

451451
.. index::

Doc/tutorial/datastructures.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -383,16 +383,16 @@ A tuple consists of a number of values separated by commas, for instance::
383383
>>> t
384384
(12345, 54321, 'hello!')
385385
>>> # Tuples may be nested:
386-
... u = t, (1, 2, 3, 4, 5)
386+
>>> u = t, (1, 2, 3, 4, 5)
387387
>>> u
388388
((12345, 54321, 'hello!'), (1, 2, 3, 4, 5))
389389
>>> # Tuples are immutable:
390-
... t[0] = 88888
390+
>>> t[0] = 88888
391391
Traceback (most recent call last):
392392
File "<stdin>", line 1, in <module>
393393
TypeError: 'tuple' object does not support item assignment
394394
>>> # but they can contain mutable objects:
395-
... v = ([1, 2, 3], [3, 2, 1])
395+
>>> v = ([1, 2, 3], [3, 2, 1])
396396
>>> v
397397
([1, 2, 3], [3, 2, 1])
398398

@@ -465,7 +465,7 @@ Here is a brief demonstration::
465465
False
466466

467467
>>> # Demonstrate set operations on unique letters from two words
468-
...
468+
>>>
469469
>>> a = set('abracadabra')
470470
>>> b = set('alacazam')
471471
>>> a # unique letters in a

Doc/tutorial/inputoutput.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ Some examples::
8787
>>> print(s)
8888
The value of x is 32.5, and y is 40000...
8989
>>> # The repr() of a string adds string quotes and backslashes:
90-
... hello = 'hello, world\n'
90+
>>> hello = 'hello, world\n'
9191
>>> hellos = repr(hello)
9292
>>> print(hellos)
9393
'hello, world\n'
9494
>>> # The argument to repr() may be any Python object:
95-
... repr((x, y, ('spam', 'eggs')))
95+
>>> repr((x, y, ('spam', 'eggs')))
9696
"(32.5, 40000, ('spam', 'eggs'))"
9797

9898
The :mod:`string` module contains a :class:`~string.Template` class that offers

Doc/tutorial/introduction.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,8 @@ together. For instance, we can write an initial sub-sequence of the
501501
as follows::
502502

503503
>>> # Fibonacci series:
504-
... # the sum of two elements defines the next
505-
... a, b = 0, 1
504+
>>> # the sum of two elements defines the next
505+
>>> a, b = 0, 1
506506
>>> while a < 10:
507507
... print(a)
508508
... a, b = b, a+b

0 commit comments

Comments
 (0)