Skip to content

Commit f36d1a9

Browse files
committed
Memoryview
1 parent 66928ac commit f36d1a9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1974,12 +1974,12 @@ Memory View
19741974
<real> = <mview>[<index>] # Returns an int or a float.
19751975
<mview> = <mview>[<slice>] # Mview with rearranged elements.
19761976
<mview> = <mview>.cast('<typecode>') # Casts memoryview to the new format.
1977-
<bin_file>.write(<mview>) # Appends mview to the binary file.
19781977
<mview>.release() # Releases the object's memory buffer.
19791978
```
19801979

19811980
### Decode
19821981
```python
1982+
<bin_file>.write(<mview>) # Appends mview to the binary file.
19831983
<bytes> = bytes(<mview>) # Creates a new bytes object.
19841984
<bytes> = <bytes>.join(<coll_of_mviews>) # Joins mviews using bytes object as sep.
19851985
<list> = list(<mview>) # Returns list of ints or floats.

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,12 +1746,12 @@
17461746
&lt;real&gt; = &lt;mview&gt;[&lt;index&gt;] <span class="hljs-comment"># Returns an int or a float.</span>
17471747
&lt;mview&gt; = &lt;mview&gt;[&lt;slice&gt;] <span class="hljs-comment"># Mview with rearranged elements.</span>
17481748
&lt;mview&gt; = &lt;mview&gt;.cast(<span class="hljs-string">'&lt;typecode&gt;'</span>) <span class="hljs-comment"># Casts memoryview to the new format.</span>
1749-
&lt;bin_file&gt;.write(&lt;mview&gt;) <span class="hljs-comment"># Appends mview to the binary file.</span>
17501749
&lt;mview&gt;.release() <span class="hljs-comment"># Releases the object's memory buffer.</span>
17511750
</code></pre></div>
17521751

17531752

1754-
<div><h3 id="decode-2">Decode</h3><pre><code class="python language-python hljs">&lt;bytes&gt; = bytes(&lt;mview&gt;) <span class="hljs-comment"># Creates a new bytes object.</span>
1753+
<div><h3 id="decode-2">Decode</h3><pre><code class="python language-python hljs">&lt;bin_file&gt;.write(&lt;mview&gt;) <span class="hljs-comment"># Appends mview to the binary file.</span>
1754+
&lt;bytes&gt; = bytes(&lt;mview&gt;) <span class="hljs-comment"># Creates a new bytes object.</span>
17551755
&lt;bytes&gt; = &lt;bytes&gt;.join(&lt;coll_of_mviews&gt;) <span class="hljs-comment"># Joins mviews using bytes object as sep.</span>
17561756
&lt;list&gt; = list(&lt;mview&gt;) <span class="hljs-comment"># Returns list of ints or floats.</span>
17571757
&lt;str&gt; = str(&lt;mview&gt;, <span class="hljs-string">'utf-8'</span>)

0 commit comments

Comments
 (0)