Skip to content

Commit 7994beb

Browse files
committed
Tuple, Range, Iterator
1 parent 3f51fe4 commit 7994beb

File tree

3 files changed

+21
-29
lines changed

3 files changed

+21
-29
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ Tuple
144144
-----
145145
**Tuple is an immutable and hashable list.**
146146
```python
147-
<tuple> = () # Or: tuple()
148-
<tuple> = (<el>,) # Or: <el>,
149-
<tuple> = (<el_1>, <el_2> [, ...]) # Or: <el_1>, <el_2> [, ...]
147+
<tuple> = () # Empty tuple.
148+
<tuple> = (<el>,) # Or: <el>,
149+
<tuple> = (<el_1>, <el_2> [, ...]) # Or: <el_1>, <el_2> [, ...]
150150
```
151151

152152
### Named Tuple
@@ -163,17 +163,17 @@ Point(x=1, y=2)
163163
1
164164
>>> getattr(p, 'y')
165165
2
166-
>>> p._fields # Or: Point._fields
167-
('x', 'y')
168166
```
169167

170168

171169
Range
172170
-----
171+
**An immutable and hashable sequence of evenly spaced integers.**
172+
173173
```python
174-
<range> = range(to_exclusive)
175-
<range> = range(from_inclusive, to_exclusive)
176-
<range> = range(from_inclusive, to_exclusive, ±step_size)
174+
<range> = range(to_exclusive) # `list(range(3)) == [0, 1, 2]`
175+
<range> = range(from_inclusive, to_exclusive) # `list(range(1, 4)) == [1, 2, 3]`
176+
<range> = range(from_inclusive, to_exclusive, ±step) # `list(range(3, 0, -1)) == [3, 2, 1]`
177177
```
178178

179179
```python
@@ -212,12 +212,12 @@ from itertools import count, repeat, cycle, chain, islice
212212

213213
```python
214214
<iter> = chain(<coll_1>, <coll_2> [, ...]) # Empties collections in order (figuratively).
215-
<iter> = chain.from_iterable(<collection>) # Empties collections inside a collection in order.
215+
<iter> = chain.from_iterable(<coll>) # Empties collections inside a collection in order.
216216
```
217217

218218
```python
219219
<iter> = islice(<coll>, to_exclusive) # Only returns first 'to_exclusive' elements.
220-
<iter> = islice(<coll>, from_inclusive, …) # `to_exclusive, step_size`.
220+
<iter> = islice(<coll>, from_inclusive, …) # `to_exclusive, +step`.
221221
```
222222

223223

index.html

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
<body>
5656
<header>
57-
<aside>June 27, 2022</aside>
57+
<aside>July 13, 2022</aside>
5858
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
5959
</header>
6060

@@ -182,9 +182,9 @@
182182
</code></pre></div>
183183

184184

185-
<div><h2 id="tuple"><a href="#tuple" name="tuple">#</a>Tuple</h2><p><strong>Tuple is an immutable and hashable list.</strong></p><pre><code class="python language-python hljs">&lt;tuple&gt; = () <span class="hljs-comment"># Or: tuple()</span>
186-
&lt;tuple&gt; = (&lt;el&gt;,) <span class="hljs-comment"># Or: &lt;el&gt;,</span>
187-
&lt;tuple&gt; = (&lt;el_1&gt;, &lt;el_2&gt; [, ...]) <span class="hljs-comment"># Or: &lt;el_1&gt;, &lt;el_2&gt; [, ...]</span>
185+
<div><h2 id="tuple"><a href="#tuple" name="tuple">#</a>Tuple</h2><p><strong>Tuple is an immutable and hashable list.</strong></p><pre><code class="python language-python hljs">&lt;tuple&gt; = () <span class="hljs-comment"># Empty tuple.</span>
186+
&lt;tuple&gt; = (&lt;el&gt;,) <span class="hljs-comment"># Or: &lt;el&gt;,</span>
187+
&lt;tuple&gt; = (&lt;el_1&gt;, &lt;el_2&gt; [, ...]) <span class="hljs-comment"># Or: &lt;el_1&gt;, &lt;el_2&gt; [, ...]</span>
188188
</code></pre></div>
189189

190190

@@ -198,16 +198,15 @@
198198
<span class="hljs-number">1</span>
199199
<span class="hljs-meta">&gt;&gt;&gt; </span>getattr(p, <span class="hljs-string">'y'</span>)
200200
<span class="hljs-number">2</span>
201-
<span class="hljs-meta">&gt;&gt;&gt; </span>p._fields <span class="hljs-comment"># Or: Point._fields</span>
202-
(<span class="hljs-string">'x'</span>, <span class="hljs-string">'y'</span>)
203201
</code></pre></div>
204202

205203

206-
<div><h2 id="range"><a href="#range" name="range">#</a>Range</h2><pre><code class="python language-python hljs">&lt;range&gt; = range(to_exclusive)
207-
&lt;range&gt; = range(from_inclusive, to_exclusive)
208-
&lt;range&gt; = range(from_inclusive, to_exclusive, ±step_size)
204+
<div><h2 id="range"><a href="#range" name="range">#</a>Range</h2><p><strong>An immutable and hashable sequence of evenly spaced integers.</strong></p><pre><code class="python language-python hljs">&lt;range&gt; = range(to_exclusive) <span class="hljs-comment"># `list(range(3)) == [0, 1, 2]`</span>
205+
&lt;range&gt; = range(from_inclusive, to_exclusive) <span class="hljs-comment"># `list(range(1, 4)) == [1, 2, 3]`</span>
206+
&lt;range&gt; = range(from_inclusive, to_exclusive, ±step) <span class="hljs-comment"># `list(range(3, 0, -1)) == [3, 2, 1]`</span>
209207
</code></pre></div>
210208

209+
211210
<pre><code class="python language-python hljs">from_inclusive = &lt;range&gt;.start
212211
to_exclusive = &lt;range&gt;.stop
213212
</code></pre>
@@ -229,10 +228,10 @@
229228
&lt;iter&gt; = cycle(&lt;collection&gt;) <span class="hljs-comment"># Repeats the sequence endlessly.</span>
230229
</code></pre>
231230
<pre><code class="python language-python hljs">&lt;iter&gt; = chain(&lt;coll_1&gt;, &lt;coll_2&gt; [, ...]) <span class="hljs-comment"># Empties collections in order (figuratively).</span>
232-
&lt;iter&gt; = chain.from_iterable(&lt;collection&gt;) <span class="hljs-comment"># Empties collections inside a collection in order.</span>
231+
&lt;iter&gt; = chain.from_iterable(&lt;coll&gt;) <span class="hljs-comment"># Empties collections inside a collection in order.</span>
233232
</code></pre>
234233
<pre><code class="python language-python hljs">&lt;iter&gt; = islice(&lt;coll&gt;, to_exclusive) <span class="hljs-comment"># Only returns first 'to_exclusive' elements.</span>
235-
&lt;iter&gt; = islice(&lt;coll&gt;, from_inclusive, …) <span class="hljs-comment"># `to_exclusive, step_size`.</span>
234+
&lt;iter&gt; = islice(&lt;coll&gt;, from_inclusive, …) <span class="hljs-comment"># `to_exclusive, +step`.</span>
236235
</code></pre>
237236
<div><h2 id="generator"><a href="#generator" name="generator">#</a>Generator</h2><ul>
238237
<li><strong>Any function that contains a yield statement returns a generator.</strong></li>
@@ -2901,7 +2900,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
29012900

29022901

29032902
<footer>
2904-
<aside>June 27, 2022</aside>
2903+
<aside>July 13, 2022</aside>
29052904
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
29062905
</footer>
29072906

parse.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -794,13 +794,6 @@ function fixStructFormatDiv() {
794794
$('#forstandardtypesizesandmanualalignmentpaddingstartformatstringwith').parent().insertBefore(div)
795795
}
796796

797-
798-
function fixStructFormat() {
799-
const div = $('#format-2').parent()
800-
$('#format-2').insertBefore(div)
801-
$('#forstandardtypesizesandmanualalignmentpaddingstartformatstringwith').parent().insertBefore(div)
802-
}
803-
804797
function updateDate(template) {
805798
const date = new Date();
806799
const date_str = date.toLocaleString('en-us', {month: 'long', day: 'numeric', year: 'numeric'});

0 commit comments

Comments
 (0)