Skip to content

Commit 030e49f

Browse files
committed
ABC
1 parent 0a5b6ba commit 030e49f

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,19 @@ Type
245245
from types import FunctionType, MethodType, LambdaType, GeneratorType
246246
```
247247

248-
### ABC-s
249-
**Abstract base classes introduce virtual subclasses, that don’t inherit from a class but are still recognized by isinstance() and issubclass().**
248+
### ABC
249+
**An abstract base class introduces virtual subclasses, that don’t inherit from it but are still recognized by isinstance() and issubclass().**
250250

251251
```python
252252
from numbers import Integral, Rational, Real, Complex, Number
253-
from collections.abc import Iterable, Collection, Sequence
253+
from collections.abc import Sequence, Collection, Iterable
254+
```
255+
256+
```python
257+
>>> isinstance(123, Number)
258+
True
259+
>>> isinstance([1, 2, 3], Iterable)
260+
True
254261
```
255262

256263

index.html

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,15 @@ <h2 id="type"><a href="#type" name="type">#</a>Type</h2>
316316
<h4 id="sometypesdonothavebuiltinnamessotheymustbeimported">Some types do not have builtin names, so they must be imported:</h4>
317317
<pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> types <span class="hljs-keyword">import</span> FunctionType, MethodType, LambdaType, GeneratorType
318318
</code></pre>
319-
<h3 id="abcs">ABC-s</h3>
320-
<p><strong>Abstract base classes introduce virtual subclasses, that don’t inherit from a class but are still recognized by isinstance() and issubclass().</strong></p>
319+
<h3 id="abc">ABC</h3>
320+
<p><strong>An abstract base class introduces virtual subclasses, that don’t inherit from it but are still recognized by isinstance() and issubclass().</strong></p>
321321
<pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> numbers <span class="hljs-keyword">import</span> Integral, Rational, Real, Complex, Number
322-
<span class="hljs-keyword">from</span> collections.abc <span class="hljs-keyword">import</span> Iterable, Collection, Sequence
322+
<span class="hljs-keyword">from</span> collections.abc <span class="hljs-keyword">import</span> Sequence, Collection, Iterable
323+
</code></pre>
324+
<pre><code class="python language-python hljs"><span class="hljs-meta">&gt;&gt;&gt; </span>isinstance(<span class="hljs-number">123</span>, Number)
325+
<span class="hljs-keyword">True</span>
326+
<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)
327+
<span class="hljs-keyword">True</span>
323328
</code></pre>
324329
<h2 id="string"><a href="#string" name="string">#</a>String</h2>
325330
<pre><code class="python language-python hljs">&lt;str&gt; = &lt;str&gt;.strip() <span class="hljs-comment"># Strips all whitespace characters from both ends.</span>

0 commit comments

Comments
 (0)