<array> = array('<typecode>', <coll_of_nums>) # Array from collection of numbers.
<array> = array('<typecode>', <coll_of_nums>) # Array from collection of numbers.
<array> = array('<typecode>', <bytes>) # Copies bytes to array's memory.
<array> = array('<typecode>', <bytes>) # Copies bytes to array's memory.
<array> = array('<typecode>', <array>) # Treats array as a sequence of numbers.
<array> = array('<typecode>', <array>) # Treats array as a sequence of numbers.
<array>.fromfile(<file>, n_items) # Appends items from binary file.
<array>.fromfile(<file>, n_items) # Appends items from the binary file.
```
```
```python
```python
@ -2058,23 +2058,23 @@ Memory View
**A sequence object that points to the memory of another bytes-like object. Each element can reference a single or multiple consecutive bytes, depending on format. Order and number of elements can be changed with slicing.**
**A sequence object that points to the memory of another bytes-like object. Each element can reference a single or multiple consecutive bytes, depending on format. Order and number of elements can be changed with slicing.**
```python
```python
<mview> = memoryview(<bytes/bytearray/array>) # Immutable if bytes, else mutable.
<mview> = memoryview(<bytes/bytearray/array>) # Immutable if bytes is passed, else mutable.
<obj> = <mview>[index] # Returns int/float (bytes if format is 'c').
<obj> = <mview>[index] # Returns int/float. Bytes if format is 'c'.
<mview> = <mview>[<slice>] # Returns mview with rearranged elements.
<mview> = <mview>[<slice>] # Returns memoryview with rearranged elements.
<mview> = <mview>.cast('<typecode>') # Only works between B/b/c and other types.
<mview> = <mview>.cast('<typecode>') # Only works between B/b/c and other types.
<mview>.release() # Releases memory buffer of the base object.
<mview>.release() # Releases memory buffer of the base object.
```
```
```python
```python
<bytes> = bytes(<mview>) # Returns a new bytes object.
<bytes> = bytes(<mview>) # Returns a new bytes object.
<bytes> = <bytes>.join(<coll_of_mviews>) # Joins mviews using bytes as a separator.
<bytes> = <bytes>.join(<coll_of_mviews>) # Joins memoryviews using bytes as a separator.
<array> = array('<typecode>', <mview>) # Treats mview as a sequence of numbers.
<array> = array('<typecode>', <mview>) # Treats memoryview as a sequence of numbers.
<file>.write(<mview>) # Writes `bytes(<mview>)` to binary file.
<file>.write(<mview>) # Writes `bytes(<mview>)` to the binary file.
```
```
```python
```python
<list> = list(<mview>) # Returns a list of ints, floats or bytes.
<list> = list(<mview>) # Returns a list of ints, floats or bytes.
<str> = str(<mview>, 'utf-8') # Treats mview as a bytes object.
<str> = str(<mview>, 'utf-8') # Treats memoryview as a bytes object.
<pre><codeclass="python language-python hljs"><array> = array(<spanclass="hljs-string">'<typecode>'</span>, <coll_of_nums>) <spanclass="hljs-comment"># Array from collection of numbers.</span>
<pre><codeclass="python language-python hljs"><array> = array(<spanclass="hljs-string">'<typecode>'</span>, <coll_of_nums>) <spanclass="hljs-comment"># Array from collection of numbers.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <bytes>) <spanclass="hljs-comment"># Copies bytes to array's memory.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <bytes>) <spanclass="hljs-comment"># Copies bytes to array's memory.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <array>) <spanclass="hljs-comment"># Treats array as a sequence of numbers.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <array>) <spanclass="hljs-comment"># Treats array as a sequence of numbers.</span>
<array>.fromfile(<file>, n_items) <spanclass="hljs-comment"># Appends items from binary file.</span>
<array>.fromfile(<file>, n_items) <spanclass="hljs-comment"># Appends items from the binary file.</span>
</code></pre>
</code></pre>
<pre><codeclass="python language-python hljs"><bytes> = bytes(<array>) <spanclass="hljs-comment"># Returns a copy of array's memory.</span>
<pre><codeclass="python language-python hljs"><bytes> = bytes(<array>) <spanclass="hljs-comment"># Returns a copy of array's memory.</span>
<file>.write(<array>) <spanclass="hljs-comment"># Writes array's memory to binary file.</span>
<file>.write(<array>) <spanclass="hljs-comment"># Writes array's memory to binary file.</span>
</code></pre>
</code></pre>
<div><h2id="memoryview"><ahref="#memoryview"name="memoryview">#</a>Memory View</h2><p><strong>A sequence object that points to the memory of another bytes-like object. Each element can reference a single or multiple consecutive bytes, depending on format. Order and number of elements can be changed with slicing.</strong></p><pre><codeclass="python language-python hljs"><mview> = memoryview(<bytes/bytearray/array>) <spanclass="hljs-comment"># Immutable if bytes, else mutable.</span>
<div><h2id="memoryview"><ahref="#memoryview"name="memoryview">#</a>Memory View</h2><p><strong>A sequence object that points to the memory of another bytes-like object. Each element can reference a single or multiple consecutive bytes, depending on format. Order and number of elements can be changed with slicing.</strong></p><pre><codeclass="python language-python hljs"><mview> = memoryview(<bytes/bytearray/array>) <spanclass="hljs-comment"># Immutable if bytes is passed, else mutable.</span>
<obj> = <mview>[index] <spanclass="hljs-comment"># Returns int/float (bytes if format is 'c').</span>
<obj> = <mview>[index] <spanclass="hljs-comment"># Returns int/float. Bytes if format is 'c'.</span>
<mview> = <mview>[<slice>] <spanclass="hljs-comment"># Returns mview with rearranged elements.</span>
<mview> = <mview>[<slice>] <spanclass="hljs-comment"># Returns memoryview with rearranged elements.</span>
<mview> = <mview>.cast(<spanclass="hljs-string">'<typecode>'</span>) <spanclass="hljs-comment"># Only works between B/b/c and other types.</span>
<mview> = <mview>.cast(<spanclass="hljs-string">'<typecode>'</span>) <spanclass="hljs-comment"># Only works between B/b/c and other types.</span>
<mview>.release() <spanclass="hljs-comment"># Releases memory buffer of the base object.</span>
<mview>.release() <spanclass="hljs-comment"># Releases memory buffer of the base object.</span>
</code></pre></div>
</code></pre></div>
<pre><codeclass="python language-python hljs"><bytes> = bytes(<mview>) <spanclass="hljs-comment"># Returns a new bytes object.</span>
<pre><codeclass="python language-python hljs"><bytes> = bytes(<mview>) <spanclass="hljs-comment"># Returns a new bytes object.</span>
<bytes> = <bytes>.join(<coll_of_mviews>) <spanclass="hljs-comment"># Joins mviews using bytes as a separator.</span>
<bytes> = <bytes>.join(<coll_of_mviews>) <spanclass="hljs-comment"># Joins memoryviews using bytes as a separator.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <mview>) <spanclass="hljs-comment"># Treats mview as a sequence of numbers.</span>
<array> = array(<spanclass="hljs-string">'<typecode>'</span>, <mview>) <spanclass="hljs-comment"># Treats memoryview as a sequence of numbers.</span>
<file>.write(<mview>) <spanclass="hljs-comment"># Writes `bytes(<mview>)` to binary file.</span>
<file>.write(<mview>) <spanclass="hljs-comment"># Writes `bytes(<mview>)` to the binary file.</span>
</code></pre>
</code></pre>
<pre><codeclass="python language-python hljs"><list> = list(<mview>) <spanclass="hljs-comment"># Returns a list of ints, floats or bytes.</span>
<pre><codeclass="python language-python hljs"><list> = list(<mview>) <spanclass="hljs-comment"># Returns a list of ints, floats or bytes.</span>
<str> = str(<mview>, <spanclass="hljs-string">'utf-8'</span>) <spanclass="hljs-comment"># Treats mview as a bytes object.</span>
<str> = str(<mview>, <spanclass="hljs-string">'utf-8'</span>) <spanclass="hljs-comment"># Treats memoryview as a bytes object.</span>
<div><h2id="deque"><ahref="#deque"name="deque">#</a>Deque</h2><p><strong>A thread-safe list with efficient appends and pops from either side. Pronounced "deck".</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> collections <spanclass="hljs-keyword">import</span> deque
<div><h2id="deque"><ahref="#deque"name="deque">#</a>Deque</h2><p><strong>A thread-safe list with efficient appends and pops from either side. Pronounced "deck".</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> collections <spanclass="hljs-keyword">import</span> deque
@ -2931,7 +2931,7 @@ $ deactivate <span class="hljs-comment"># Deactivates the active
xxxxxxxxxx