]> granicus.if.org Git - python/commitdiff
Clarification. Yay importlib!
authorGeorg Brandl <georg@python.org>
Mon, 19 Jul 2010 11:28:05 +0000 (11:28 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 19 Jul 2010 11:28:05 +0000 (11:28 +0000)
Doc/tutorial/classes.rst

index 6b0efc3d563bc01e8487ce9d7dc4166f88a279df..da4d520b80580d8090e550093fc7db180e98d1e5 100644 (file)
@@ -737,7 +737,7 @@ built-in function; this example shows how it all works::
    StopIteration
 
 Having seen the mechanics behind the iterator protocol, it is easy to add
-iterator behavior to your classes.  Define a :meth:`__iter__` method which
+iterator behavior to your classes.  Define an :meth:`__iter__` method which
 returns an object with a :meth:`__next__` method.  If the class defines
 :meth:`__next__`, then :meth:`__iter__` can just return ``self``::
 
@@ -754,7 +754,10 @@ returns an object with a :meth:`__next__` method.  If the class defines
            self.index = self.index - 1
            return self.data[self.index]
 
-   >>> for char in Reverse('spam'):
+   >>> rev = Reverse('spam')
+   >>> iter(rev)
+   <__main__.Reverse object at 0x00A1DB50>
+   >>> for char in rev:
    ...     print(char)
    ...
    m