Browse Source

Numbers, Exceptions

pull/116/merge
Jure Šorn 3 months ago
parent
commit
973c39727d
3 changed files with 6 additions and 6 deletions
  1. 4
      README.md
  2. 4
      index.html
  3. 4
      parse.js

4
README.md

@ -530,7 +530,7 @@ from random import random, randint, choice # Also: shuffle, gauss, triang
<int> = ±0b<bin> # Or: ±0x<hex>
<int> = int('±<bin>', 2) # Or: int('±<hex>', 16)
<int> = int('±0b<bin>', 0) # Or: int('±0x<hex>', 0)
<str> = bin(<int>) # Returns '[-]0b<bin>'.
<str> = bin(<int>) # Returns '[-]0b<bin>'. Also hex().
```
### Bitwise Operators
@ -1456,7 +1456,7 @@ BaseException
+-- LookupError # Base class for errors when a collection can't find an item.
| +-- IndexError # Raised when a sequence index is out of range.
| +-- KeyError # Raised when a dictionary key or set element is missing.
+-- MemoryError # Out of memory. May be too late to start deleting objects.
+-- MemoryError # Out of memory. May be too late to start deleting variables.
+-- NameError # Raised when nonexistent name (variable/func/class) is used.
| +-- UnboundLocalError # Raised when local name is used before it's being defined.
+-- OSError # Errors such as FileExistsError/TimeoutError (see #Open).

4
index.html

@ -477,7 +477,7 @@ Point(x=<span class="hljs-number">1</span>, y=<span class="hljs-number">2</span>
<div><h3 id="binhex">Bin, Hex</h3><pre><code class="python language-python hljs">&lt;int&gt; = ±<span class="hljs-number">0b</span>&lt;bin&gt; <span class="hljs-comment"># Or: ±0x&lt;hex&gt;</span>
&lt;int&gt; = int(<span class="hljs-string">&lt;bin&gt;'</span>, <span class="hljs-number">2</span>) <span class="hljs-comment"># Or: int('±&lt;hex&gt;', 16)</span>
&lt;int&gt; = int(<span class="hljs-string">'±0b&lt;bin&gt;'</span>, <span class="hljs-number">0</span>) <span class="hljs-comment"># Or: int('±0x&lt;hex&gt;', 0)</span>
&lt;str&gt; = bin(&lt;int&gt;) <span class="hljs-comment"># Returns '[-]0b&lt;bin&gt;'.</span>
&lt;str&gt; = bin(&lt;int&gt;) <span class="hljs-comment"># Returns '[-]0b&lt;bin&gt;'. Also hex().</span>
</code></pre></div>
<div><h3 id="bitwiseoperators">Bitwise Operators</h3><pre><code class="python language-python hljs">&lt;int&gt; = &lt;int&gt; &amp; &lt;int&gt; <span class="hljs-comment"># And (0b1100 &amp; 0b1010 == 0b1000).</span>
@ -1240,7 +1240,7 @@ error_msg = <span class="hljs-string">''</span>.join(traceback.format_exception(
├── LookupError <span class="hljs-comment"># Base class for errors when a collection can't find an item.</span>
│ ├── IndexError <span class="hljs-comment"># Raised when a sequence index is out of range.</span>
│ └── KeyError <span class="hljs-comment"># Raised when a dictionary key or set element is missing.</span>
├── MemoryError <span class="hljs-comment"># Out of memory. May be too late to start deleting objects.</span>
├── MemoryError <span class="hljs-comment"># Out of memory. May be too late to start deleting variables.</span>
├── NameError <span class="hljs-comment"># Raised when nonexistent name (variable/func/class) is used.</span>
│ └── UnboundLocalError <span class="hljs-comment"># Raised when local name is used before it's being defined.</span>
├── OSError <span class="hljs-comment"># Errors such as FileExistsError/TimeoutError (see #Open).</span>

4
parse.js

@ -48,7 +48,7 @@ const BIN_HEX =
'&lt;int&gt; = ±<span class="hljs-number">0b</span>&lt;bin&gt; <span class="hljs-comment"># Or: ±0x&lt;hex&gt;</span>\n' +
'&lt;int&gt; = int(<span class="hljs-string">\'±&lt;bin&gt;\'</span>, <span class="hljs-number">2</span>) <span class="hljs-comment"># Or: int(\'±&lt;hex&gt;\', 16)</span>\n' +
'&lt;int&gt; = int(<span class="hljs-string">\'±0b&lt;bin&gt;\'</span>, <span class="hljs-number">0</span>) <span class="hljs-comment"># Or: int(\'±0x&lt;hex&gt;\', 0)</span>\n' +
'&lt;str&gt; = bin(&lt;int&gt;) <span class="hljs-comment"># Returns \'[-]0b&lt;bin&gt;\'.</span>\n';
'&lt;str&gt; = bin(&lt;int&gt;) <span class="hljs-comment"># Returns \'[-]0b&lt;bin&gt;\'. Also hex().</span>\n';
const LRU_CACHE =
'<span class="hljs-keyword">from</span> functools <span class="hljs-keyword">import</span> lru_cache\n' +
@ -441,7 +441,7 @@ const DIAGRAM_7_B =
" ├── LookupError <span class='hljs-comment'># Base class for errors when a collection can't find an item.</span>\n" +
" │ ├── IndexError <span class='hljs-comment'># Raised when a sequence index is out of range.</span>\n" +
" │ └── KeyError <span class='hljs-comment'># Raised when a dictionary key or set element is missing.</span>\n" +
" ├── MemoryError <span class='hljs-comment'># Out of memory. May be too late to start deleting objects.</span>\n" +
" ├── MemoryError <span class='hljs-comment'># Out of memory. May be too late to start deleting variables.</span>\n" +
" ├── NameError <span class='hljs-comment'># Raised when nonexistent name (variable/func/class) is used.</span>\n" +
" │ └── UnboundLocalError <span class='hljs-comment'># Raised when local name is used before it's being defined.</span>\n" +
" ├── OSError <span class='hljs-comment'># Errors such as FileExistsError/TimeoutError (see #Open).</span>\n" +

Loading…
Cancel
Save