[Python-checkins] cpython (3.2): Split combined code/doctest code blocks in two blocks, to enable proper

georg.brandl python-checkins at python.org
Sun May 1 22:38:00 CEST 2011


http://hg.python.org/cpython/rev/13878873ccc7
changeset:   69738:13878873ccc7
branch:      3.2
parent:      69734:bbc6129f7861
user:        Georg Brandl <georg at python.org>
date:        Sun May 01 22:37:23 2011 +0200
summary:
  Split combined code/doctest code blocks in two blocks, to enable proper highlighting.

files:
  Doc/tutorial/classes.rst |  7 +++++--
  1 files changed, 5 insertions(+), 2 deletions(-)


diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst
--- a/Doc/tutorial/classes.rst
+++ b/Doc/tutorial/classes.rst
@@ -730,7 +730,6 @@
    >>> next(it)
    'c'
    >>> next(it)
-
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
        next(it)
@@ -742,7 +741,7 @@
 :meth:`__next__`, then :meth:`__iter__` can just return ``self``::
 
    class Reverse:
-       "Iterator for looping over a sequence backwards"
+       """Iterator for looping over a sequence backwards."""
        def __init__(self, data):
            self.data = data
            self.index = len(data)
@@ -754,6 +753,8 @@
            self.index = self.index - 1
            return self.data[self.index]
 
+::
+
    >>> rev = Reverse('spam')
    >>> iter(rev)
    <__main__.Reverse object at 0x00A1DB50>
@@ -782,6 +783,8 @@
        for index in range(len(data)-1, -1, -1):
            yield data[index]
 
+::
+
    >>> for char in reverse('golf'):
    ...     print(char)
    ...

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list