diff options
author | Georg Brandl <georg@python.org> | 2011-05-01 20:34:31 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2011-05-01 20:34:31 (GMT) |
commit | 2cdee708e9ec4c8445f2a269b87efb9a148e097f (patch) | |
tree | f67c85ceafc435f959c13c7b341663679c133229 /Doc/tutorial | |
parent | 90c3fb6e7674fe62cfb2f6db11e22b0beeb0505c (diff) | |
download | cpython-2cdee708e9ec4c8445f2a269b87efb9a148e097f.zip cpython-2cdee708e9ec4c8445f2a269b87efb9a148e097f.tar.gz cpython-2cdee708e9ec4c8445f2a269b87efb9a148e097f.tar.bz2 |
Split combined code/doctest code blocks in two blocks, to enable proper highlighting.
Diffstat (limited to 'Doc/tutorial')
-rw-r--r-- | Doc/tutorial/classes.rst | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index a0f2431..04abcf3 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -754,6 +754,8 @@ returns an object with a :meth:`__next__` method. If the class defines self.index = self.index - 1 return self.data[self.index] +:: + >>> rev = Reverse('spam') >>> iter(rev) <__main__.Reverse object at 0x00A1DB50> @@ -782,6 +784,8 @@ easy to create:: for index in range(len(data)-1, -1, -1): yield data[index] +:: + >>> for char in reverse('golf'): ... print(char) ... |