You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***Other ABCs that generate missing methods are: MutableSequence, Set, MutableSet, Mapping and MutableMapping. Required methods:`'<abc>.__abstractmethods__'`.**
1286
+
***Other ABCs that generate missing methods are: MutableSequence, Set, MutableSet, Mapping and MutableMapping.**
1287
+
***Names of their required methods are stored in`'<abc>.__abstractmethods__'`.**
1288
1288
1289
1289
1290
1290
Enum
@@ -2136,7 +2136,7 @@ class MyMetaClass(type):
2136
2136
***New() can also be called directly, usually from a new() method of a child class (**`def __new__(cls): return super().__new__(cls)`**), in which case init() is not called.**
2137
2137
2138
2138
### Metaclass Attribute
2139
-
**Right before a class is created it checks if it has metaclass attribute defined. If not, it recursively checks if any of his parents has it defined and eventually comes to type().**
2139
+
**Right before a class is created it checks if it has a 'metaclass' attribute defined. If not, it recursively checks if any of his parents has it defined and eventually comes to type().**
Copy file name to clipboardExpand all lines: index.html
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1209,7 +1209,8 @@
1209
1209
</code></pre></div>
1210
1210
1211
1211
<ul>
1212
-
<li><strong>Other ABCs that generate missing methods are: MutableSequence, Set, MutableSet, Mapping and MutableMapping. Required methods: <codeclass="python hljs"><spanclass="hljs-string">'<abc>.__abstractmethods__'</span></code>.</strong></li>
1212
+
<li><strong>Other ABCs that generate missing methods are: MutableSequence, Set, MutableSet, Mapping and MutableMapping.</strong></li>
1213
+
<li><strong>Names of their required methods are stored in <codeclass="python hljs"><spanclass="hljs-string">'<abc>.__abstractmethods__'</span></code>.</strong></li>
1213
1214
</ul>
1214
1215
<div><h2id="enum"><ahref="#enum" name="enum">#</a>Enum</h2><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> enum <spanclass="hljs-keyword">import</span> Enum, auto
1215
1216
@@ -1860,7 +1861,7 @@
1860
1861
<li><strong>It receives the same arguments as init(), except for the first one that specifies the desired class of returned instance (MyMetaClass in our case).</strong></li>
1861
1862
<li><strong>New() can also be called directly, usually from a new() method of a child class (</strong><codeclass="python hljs"><spanclass="hljs-function"><spanclass="hljs-keyword">def</span><spanclass="hljs-title">__new__</span><spanclass="hljs-params">(cls)</span>:</span><spanclass="hljs-keyword">return</span> super().__new__(cls)</code><strong>), in which case init() is not called.</strong></li>
1862
1863
</ul>
1863
-
<div><h3id="metaclassattribute">Metaclass Attribute</h3><p><strong>Right before a class is created it checks if it has metaclass attribute defined. If not, it recursively checks if any of his parents has it defined and eventually comes to type().</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-class"><spanclass="hljs-keyword">class</span><spanclass="hljs-title">MyClass</span><spanclass="hljs-params">(metaclass=MyMetaClass)</span>:</span>
1864
+
<div><h3id="metaclassattribute">Metaclass Attribute</h3><p><strong>Right before a class is created it checks if it has a 'metaclass' attribute defined. If not, it recursively checks if any of his parents has it defined and eventually comes to type().</strong></p><pre><codeclass="python language-python hljs"><spanclass="hljs-class"><spanclass="hljs-keyword">class</span><spanclass="hljs-title">MyClass</span><spanclass="hljs-params">(metaclass=MyMetaClass)</span>:</span>
0 commit comments