Kaydet (Commit) 2cdee708 authored tarafından Georg Brandl's avatar Georg Brandl

Split combined code/doctest code blocks in two blocks, to enable proper highlighting.

üst 90c3fb6e
...@@ -754,6 +754,8 @@ returns an object with a :meth:`__next__` method. If the class defines ...@@ -754,6 +754,8 @@ returns an object with a :meth:`__next__` method. If the class defines
self.index = self.index - 1 self.index = self.index - 1
return self.data[self.index] return self.data[self.index]
::
>>> rev = Reverse('spam') >>> rev = Reverse('spam')
>>> iter(rev) >>> iter(rev)
<__main__.Reverse object at 0x00A1DB50> <__main__.Reverse object at 0x00A1DB50>
...@@ -782,6 +784,8 @@ easy to create:: ...@@ -782,6 +784,8 @@ easy to create::
for index in range(len(data)-1, -1, -1): for index in range(len(data)-1, -1, -1):
yield data[index] yield data[index]
::
>>> for char in reverse('golf'): >>> for char in reverse('golf'):
... print(char) ... print(char)
... ...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment