Browse Source

Metaprograming

pull/36/head
Jure Šorn 5 years ago
parent
commit
cbdad5e3a8
2 changed files with 4 additions and 6 deletions
  1. 5
      README.md
  2. 5
      index.html

5
README.md

@ -1725,7 +1725,6 @@ class MyClass(metaclass=MyMetaClass):
```python
type(MyClass) == MyMetaClass # MyClass is an instance of MyMetaClass.
type(MyMetaClass) == type # MyMetaClass is an instance of type.
type(type) == type # Type is an instance of type.
```
```text
@ -1742,8 +1741,8 @@ type(type) == type # Type is an instance of type.
### Inheritance Diagram
```python
MyClass.__base__ == object # MyClass is a subclass of object.
object.__base__ == None # Object is a subclass to no one.
MyClass.__base__ == object # MyClass is a subclass of object.
MyMetaClass.__base__ == type # MyMetaClass is a subclass of type.
```
```text

5
index.html

@ -1469,7 +1469,6 @@ param_names = list(<sig>.parameters.keys())
<h3 id="typediagram">Type Diagram</h3>
<pre><code class="python language-python hljs">type(MyClass) == MyMetaClass <span class="hljs-comment"># MyClass is an instance of MyMetaClass.</span>
type(MyMetaClass) == type <span class="hljs-comment"># MyMetaClass is an instance of type.</span>
type(type) == type <span class="hljs-comment"># Type is an instance of type.</span>
</code></pre>
<pre><code class="text language-text">┏━━━━━━━━━┯━━━━━━━━━━━━━┓
┃ Classes │ Metaclasses ┃
@ -1482,8 +1481,8 @@ type(type) == type <span class="hljs-comment"># Type is an instan
┗━━━━━━━━━┷━━━━━━━━━━━━━┛
</code></pre>
<h3 id="inheritancediagram">Inheritance Diagram</h3>
<pre><code class="python language-python hljs">MyClass.__base__ == object <span class="hljs-comment"># MyClass is a subclass of object.</span>
object.__base__ == <span class="hljs-keyword">None</span> <span class="hljs-comment"># Object is a subclass to no one.</span>
<pre><code class="python language-python hljs">MyClass.__base__ == object <span class="hljs-comment"># MyClass is a subclass of object.</span>
MyMetaClass.__base__ == type <span class="hljs-comment"># MyMetaClass is a subclass of type.</span>
</code></pre>
<pre><code class="text language-text">┏━━━━━━━━━┯━━━━━━━━━━━━━┓
┃ Classes │ Metaclasses ┃

Loading…
Cancel
Save