Skip to content

Commit 4086f76

Browse files
committed
Collection, Open
1 parent c13adfe commit 4086f76

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ True
12391239
### Collection
12401240
* **Only required methods are iter() and len().**
12411241
* **This cheatsheet actually means `'<iterable>'` when it uses `'<collection>'`.**
1242-
* **I chose not to use the name 'iterable' because it sounds scarier and more vague than 'collection'. The only drawback of this decision is that a reader could think a certain function doesn't accept iterators when it does, since iterators are the only iterable objects that are not collections.**
1242+
* **I chose not to use the name 'iterable' because it sounds scarier and more vague than 'collection'. The only drawback of this decision is that a reader could think a certain function doesn't accept iterators when it does, since iterators are the only built-in objects that are iterable but are not collections.**
12431243
```python
12441244
class MyCollection:
12451245
def __init__(self, a):
@@ -1548,7 +1548,7 @@ Open
15481548
```
15491549
* **`'encoding=None'` means that the default encoding is used, which is platform dependent. Best practice is to use `'encoding="utf-8"'` whenever possible.**
15501550
* **`'newline=None'` means all different end of line combinations are converted to '\n' on read, while on write all '\n' characters are converted to system's default line separator.**
1551-
* **`'newline=""'` means no conversions take place, but input is still broken into chunks by readline() and readlines() on either '\n', '\r' or '\r\n'.**
1551+
* **`'newline=""'` means no conversions take place, but input is still broken into chunks by readline() and readlines() on '\n', '\r' and '\r\n'.**
15521552

15531553
### Modes
15541554
* **`'r'` - Read (default).**
@@ -1585,7 +1585,7 @@ Open
15851585
```python
15861586
<file>.write(<str/bytes>) # Writes a string or bytes object.
15871587
<file>.writelines(<collection>) # Writes a coll. of strings or bytes objects.
1588-
<file>.flush() # Flushes write buffer.
1588+
<file>.flush() # Flushes write buffer. Runs every 4096/8192 B.
15891589
```
15901590
* **Methods do not add or strip trailing newlines, even writelines().**
15911591

index.html

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

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

@@ -1057,7 +1057,7 @@
10571057
<div><h3 id="collection">Collection</h3><ul>
10581058
<li><strong>Only required methods are iter() and len().</strong></li>
10591059
<li><strong>This cheatsheet actually means <code class="python hljs"><span class="hljs-string">'&lt;iterable&gt;'</span></code> when it uses <code class="python hljs"><span class="hljs-string">'&lt;collection&gt;'</span></code>.</strong></li>
1060-
<li><strong>I chose not to use the name 'iterable' because it sounds scarier and more vague than 'collection'. The only drawback of this decision is that a reader could think a certain function doesn't accept iterators when it does, since iterators are the only iterable objects that are not collections.</strong></li>
1060+
<li><strong>I chose not to use the name 'iterable' because it sounds scarier and more vague than 'collection'. The only drawback of this decision is that a reader could think a certain function doesn't accept iterators when it does, since iterators are the only built-in objects that are iterable but are not collections.</strong></li>
10611061
</ul><pre><code class="python language-python hljs"><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyCollection</span>:</span>
10621062
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, a)</span>:</span>
10631063
self.a = a
@@ -1319,7 +1319,7 @@
13191319
<ul>
13201320
<li><strong><code class="python hljs"><span class="hljs-string">'encoding=None'</span></code> means that the default encoding is used, which is platform dependent. Best practice is to use <code class="python hljs"><span class="hljs-string">'encoding="utf-8"'</span></code> whenever possible.</strong></li>
13211321
<li><strong><code class="python hljs"><span class="hljs-string">'newline=None'</span></code> means all different end of line combinations are converted to '\n' on read, while on write all '\n' characters are converted to system's default line separator.</strong></li>
1322-
<li><strong><code class="python hljs"><span class="hljs-string">'newline=""'</span></code> means no conversions take place, but input is still broken into chunks by readline() and readlines() on either '\n', '\r' or '\r\n'.</strong></li>
1322+
<li><strong><code class="python hljs"><span class="hljs-string">'newline=""'</span></code> means no conversions take place, but input is still broken into chunks by readline() and readlines() on '\n', '\r' and '\r\n'.</strong></li>
13231323
</ul>
13241324
<div><h3 id="modes">Modes</h3><ul>
13251325
<li><strong><code class="python hljs"><span class="hljs-string">'r'</span></code> - Read (default).</strong></li>
@@ -1353,7 +1353,7 @@
13531353
</code></pre>
13541354
<pre><code class="python language-python hljs">&lt;file&gt;.write(&lt;str/bytes&gt;) <span class="hljs-comment"># Writes a string or bytes object.</span>
13551355
&lt;file&gt;.writelines(&lt;collection&gt;) <span class="hljs-comment"># Writes a coll. of strings or bytes objects.</span>
1356-
&lt;file&gt;.flush() <span class="hljs-comment"># Flushes write buffer.</span>
1356+
&lt;file&gt;.flush() <span class="hljs-comment"># Flushes write buffer. Runs every 4096/8192 B.</span>
13571357
</code></pre>
13581358
<ul>
13591359
<li><strong>Methods do not add or strip trailing newlines, even writelines().</strong></li>
@@ -2884,7 +2884,7 @@
28842884

28852885

28862886
<footer>
2887-
<aside>March 1, 2022</aside>
2887+
<aside>March 2, 2022</aside>
28882888
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
28892889
</footer>
28902890

0 commit comments

Comments
 (0)