Skip to content

Commit b436d17

Browse files
committed
Metaprograming
1 parent 84ae7a3 commit b436d17

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2126,7 +2126,7 @@ Metaprograming
21262126
**Type is the root class. If only passed an object it returns its type (class). Otherwise it creates a new class.**
21272127

21282128
```python
2129-
<class> = type(<class_name>, <parents_tuple>, <attributes_dict>)
2129+
<class> = type('<class_name>', <parents_tuple>, <attributes_dict>)
21302130
```
21312131

21322132
```python

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,7 @@
18521852
param_names = list(&lt;sig&gt;.parameters.keys())
18531853
</code></pre></div>
18541854

1855-
<div><h2 id="metaprograming"><a href="#metaprograming" name="metaprograming">#</a>Metaprograming</h2><p><strong>Code that generates code.</strong></p><div><h3 id="type-1">Type</h3><p><strong>Type is the root class. If only passed an object it returns its type (class). Otherwise it creates a new class.</strong></p><pre><code class="python language-python hljs"><code class="python language-python hljs">&lt;class&gt; = type(&lt;class_name&gt;, &lt;parents_tuple&gt;, &lt;attributes_dict&gt;)</code></code></pre></div></div>
1855+
<div><h2 id="metaprograming"><a href="#metaprograming" name="metaprograming">#</a>Metaprograming</h2><p><strong>Code that generates code.</strong></p><div><h3 id="type-1">Type</h3><p><strong>Type is the root class. If only passed an object it returns its type (class). Otherwise it creates a new class.</strong></p><pre><code class="python language-python hljs"><code class="python language-python hljs">&lt;class&gt; = type(<span class="hljs-string">'&lt;class_name&gt;'</span>, &lt;parents_tuple&gt;, &lt;attributes_dict&gt;)</code></code></pre></div></div>
18561856

18571857

18581858

parse.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const LRU_CACHE =
5555
' <span class="hljs-keyword">return</span> n <span class="hljs-keyword">if</span> n &lt; <span class="hljs-number">2</span> <span class="hljs-keyword">else</span> fib(n-<span class="hljs-number">2</span>) + fib(n-<span class="hljs-number">1</span>)\n';
5656

5757
const TYPE =
58-
'<code class="python language-python hljs">&lt;class&gt; = type(&lt;class_name&gt;, &lt;parents_tuple&gt;, &lt;attributes_dict&gt;)</code>';
58+
'<code class="python language-python hljs">&lt;class&gt; = type(<span class="hljs-string">\'&lt;class_name&gt;\'</span>, &lt;parents_tuple&gt;, &lt;attributes_dict&gt;)</code>';
5959

6060
const DATACLASS =
6161
'<code class="python language-python hljs"><span class="hljs-keyword">from</span> dataclasses <span class="hljs-keyword">import</span> make_dataclass\n' +
@@ -154,7 +154,7 @@ function fixHighlights() {
154154
$(`code:contains(shutil.copy)`).html(SHUTIL_COPY);
155155
$(`code:contains(ValueError: malformed node)`).html(EVAL);
156156
$(`code:contains(@lru_cache(maxsize=None))`).html(LRU_CACHE);
157-
$(`code:contains(<class_name>, <parents_tuple>, <attributes_dict>)`).html(TYPE);
157+
$(`code:contains(\'<class_name>\', <parents_tuple>, <attributes_dict>)`).html(TYPE);
158158
$(`code:contains(make_dataclass(\'<class_name>\')`).html(DATACLASS);
159159
}
160160

0 commit comments

Comments
 (0)