Skip to content

Commit 72549fb

Browse files
committed
General fixes from Type until Exceptions
1 parent aaace26 commit 72549fb

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ from types import FunctionType, MethodType, LambdaType, GeneratorType
262262
```
263263

264264
### Abstract Base Classes
265-
**Each abstract base class specifies a set of virtual subclasses. This classes get recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not.**
265+
**Each abstract base class specifies a set of virtual subclasses. This classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not.**
266266

267267
```python
268268
>>> from collections.abc import Sequence, Collection, Iterable
@@ -500,7 +500,7 @@ Numbers
500500

501501
### Math
502502
```python
503-
from math import e, pi, inf, nan
503+
from math import e, pi, inf, nan, isinf, isnan
504504
from math import cos, acos, sin, asin, tan, atan, degrees, radians
505505
from math import log, log10, log2
506506
```
@@ -1255,7 +1255,7 @@ class MySequence:
12551255
return reversed(self.a)
12561256
```
12571257

1258-
### Collections.abc.Sequence
1258+
### ABC Sequence
12591259
* **It's a richer interface than the basic sequence.**
12601260
* **Extending it generates iter(), contains(), reversed(), index() and count().**
12611261
* **Unlike `'abc.Iterable'` and `'abc.Collection'`, it is not a duck type. That is why `'issubclass(MySequence, abc.Sequence)'` would return False even if MySequence had all the methods defined.**
@@ -1415,7 +1415,7 @@ BaseException
14151415
+-- NameError # Raised when a variable name is not found.
14161416
+-- OSError # Failures such as “file not found” or “disk full”.
14171417
| +-- FileNotFoundError # When a file or directory is requested but doesn't exist.
1418-
+-- RuntimeError # Raised by errors that don't fall in other categories.
1418+
+-- RuntimeError # Raised by errors that don't fall into other categories.
14191419
| +-- RecursionError # Raised when the maximum recursion depth is exceeded.
14201420
+-- StopIteration # Raised by next() when run on an empty iterator.
14211421
+-- TypeError # Raised when an argument is of wrong type.
@@ -1458,8 +1458,8 @@ Exit
14581458
```python
14591459
import sys
14601460
sys.exit() # Exits with exit code 0 (success).
1461-
sys.exit(<int>) # Exits with passed exit code.
1462-
sys.exit(<obj>) # Prints the object and exits with 1 (failure).
1461+
sys.exit(<el>) # Prints object to stderr and exits with 1.
1462+
sys.exit(<int>) # Exits with the passed exit code.
14631463
```
14641464

14651465

index.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@
392392
<div><h4 id="sometypesdonothavebuiltinnamessotheymustbeimported">Some types do not have built-in names, so they must be imported:</h4><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> types <span class="hljs-keyword">import</span> FunctionType, MethodType, LambdaType, GeneratorType
393393
</code></pre></div>
394394

395-
<div><h3 id="abstractbaseclasses">Abstract Base Classes</h3><p><strong>Each abstract base class specifies a set of virtual subclasses. This classes get recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not.</strong></p><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> collections.abc <span class="hljs-keyword">import</span> Sequence, Collection, Iterable
395+
<div><h3 id="abstractbaseclasses">Abstract Base Classes</h3><p><strong>Each abstract base class specifies a set of virtual subclasses. This classes are then recognized by isinstance() and issubclass() as subclasses of the ABC, although they are really not.</strong></p><pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> collections.abc <span class="hljs-keyword">import</span> Sequence, Collection, Iterable
396396
<span class="hljs-meta">&gt;&gt;&gt; </span>isinstance([<span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>], Iterable)
397397
<span class="hljs-keyword">True</span>
398398
</code></pre></div>
@@ -582,7 +582,7 @@
582582
&lt;num&gt; = round(&lt;num&gt; [, ±ndigits]) <span class="hljs-comment"># `round(126, -1) == 130`</span>
583583
</code></pre></div>
584584

585-
<div><h3 id="math">Math</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> math <span class="hljs-keyword">import</span> e, pi, inf, nan
585+
<div><h3 id="math">Math</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> math <span class="hljs-keyword">import</span> e, pi, inf, nan, isinf, isnan
586586
<span class="hljs-keyword">from</span> math <span class="hljs-keyword">import</span> cos, acos, sin, asin, tan, atan, degrees, radians
587587
<span class="hljs-keyword">from</span> math <span class="hljs-keyword">import</span> log, log10, log2
588588
</code></pre></div>
@@ -1194,7 +1194,7 @@
11941194
</code></pre></div>
11951195

11961196

1197-
<div><h3 id="collectionsabcsequence">Collections.abc.Sequence</h3><ul>
1197+
<div><h3 id="abcsequence">ABC Sequence</h3><ul>
11981198
<li><strong>It's a richer interface than the basic sequence.</strong></li>
11991199
<li><strong>Extending it generates iter(), contains(), reversed(), index() and count().</strong></li>
12001200
<li><strong>Unlike <code class="python hljs"><span class="hljs-string">'abc.Iterable'</span></code> and <code class="python hljs"><span class="hljs-string">'abc.Collection'</span></code>, it is not a duck type. That is why <code class="python hljs"><span class="hljs-string">'issubclass(MySequence, abc.Sequence)'</span></code> would return False even if MySequence had all the methods defined.</strong></li>
@@ -1329,7 +1329,7 @@
13291329
+-- NameError # Raised when a variable name is not found.
13301330
+-- OSError # Failures such as “file not found” or “disk full”.
13311331
| +-- FileNotFoundError # When a file or directory is requested but doesn't exist.
1332-
+-- RuntimeError # Raised by errors that don't fall in other categories.
1332+
+-- RuntimeError # Raised by errors that don't fall into other categories.
13331333
| +-- RecursionError # Raised when the maximum recursion depth is exceeded.
13341334
+-- StopIteration # Raised by next() when run on an empty iterator.
13351335
+-- TypeError # Raised when an argument is of wrong type.
@@ -1361,8 +1361,8 @@
13611361

13621362
<div><h2 id="exit"><a href="#exit" name="exit">#</a>Exit</h2><p><strong>Exits the interpreter by raising SystemExit exception.</strong></p><pre><code class="python language-python hljs"><span class="hljs-keyword">import</span> sys
13631363
sys.exit() <span class="hljs-comment"># Exits with exit code 0 (success).</span>
1364-
sys.exit(&lt;int&gt;) <span class="hljs-comment"># Exits with passed exit code.</span>
1365-
sys.exit(&lt;obj&gt;) <span class="hljs-comment"># Prints the object and exits with 1 (failure).</span>
1364+
sys.exit(&lt;el&gt;) <span class="hljs-comment"># Prints object to stderr and exits with 1.</span>
1365+
sys.exit(&lt;int&gt;) <span class="hljs-comment"># Exits with the passed exit code.</span>
13661366
</code></pre></div>
13671367

13681368

0 commit comments

Comments
 (0)