Browse Source

Iterator

pull/36/head
Jure Šorn 5 years ago
parent
commit
6000650631
2 changed files with 2 additions and 4 deletions
  1. 3
      README.md
  2. 3
      index.html

3
README.md

@ -178,9 +178,8 @@ Point(x=1, y=2)
Iterator Iterator
-------- --------
**Iterator is any object with next() special method.**
```python ```python
<iter> = iter(<collection>) # Calling `iter(<iter>)` returns the same object.
<iter> = iter(<collection>)
<iter> = iter(<function>, to_exclusive) # Sequence of return values until 'to_exclusive'. <iter> = iter(<function>, to_exclusive) # Sequence of return values until 'to_exclusive'.
<el> = next(<iter> [, default]) # Raises StopIteration or returns 'default' on end. <el> = next(<iter> [, default]) # Raises StopIteration or returns 'default' on end.
``` ```

3
index.html

@ -320,8 +320,7 @@ Point(x=<span class="hljs-number">1</span>, y=<span class="hljs-number">2</span>
(<span class="hljs-string">'x'</span>, <span class="hljs-string">'y'</span>) (<span class="hljs-string">'x'</span>, <span class="hljs-string">'y'</span>)
</code></pre> </code></pre>
<h2 id="iterator"><a href="#iterator" name="iterator">#</a>Iterator</h2> <h2 id="iterator"><a href="#iterator" name="iterator">#</a>Iterator</h2>
<p><strong>Iterator is any object with next() special method.</strong></p>
<pre><code class="python language-python hljs">&lt;iter&gt; = iter(&lt;collection&gt;) <span class="hljs-comment"># Calling `iter(&lt;iter&gt;)` returns the same object.</span>
<pre><code class="python language-python hljs">&lt;iter&gt; = iter(&lt;collection&gt;)
&lt;iter&gt; = iter(&lt;function&gt;, to_exclusive) <span class="hljs-comment"># Sequence of return values until 'to_exclusive'.</span> &lt;iter&gt; = iter(&lt;function&gt;, to_exclusive) <span class="hljs-comment"># Sequence of return values until 'to_exclusive'.</span>
&lt;el&gt; = next(&lt;iter&gt; [, default]) <span class="hljs-comment"># Raises StopIteration or returns 'default' on end.</span> &lt;el&gt; = next(&lt;iter&gt; [, default]) <span class="hljs-comment"># Raises StopIteration or returns 'default' on end.</span>
</code></pre> </code></pre>

Loading…
Cancel
Save