Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit da623ed

Browse files
committed
Split combined code/doctest code blocks in two blocks, to enable proper highlighting.
1 parent e97f14c commit da623ed

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Doc/tutorial/classes.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ built-in function; this example shows how it all works::
730730
>>> next(it)
731731
'c'
732732
>>> next(it)
733-
734733
Traceback (most recent call last):
735734
File "<stdin>", line 1, in ?
736735
next(it)
@@ -742,7 +741,7 @@ returns an object with a :meth:`__next__` method. If the class defines
742741
:meth:`__next__`, then :meth:`__iter__` can just return ``self``::
743742

744743
class Reverse:
745-
"Iterator for looping over a sequence backwards"
744+
"""Iterator for looping over a sequence backwards."""
746745
def __init__(self, data):
747746
self.data = data
748747
self.index = len(data)
@@ -754,6 +753,8 @@ returns an object with a :meth:`__next__` method. If the class defines
754753
self.index = self.index - 1
755754
return self.data[self.index]
756755

756+
::
757+
757758
>>> rev = Reverse('spam')
758759
>>> iter(rev)
759760
<__main__.Reverse object at 0x00A1DB50>
@@ -782,6 +783,8 @@ easy to create::
782783
for index in range(len(data)-1, -1, -1):
783784
yield data[index]
784785

786+
::
787+
785788
>>> for char in reverse('golf'):
786789
... print(char)
787790
...

0 commit comments

Comments
 (0)