Browse Source

Introspection

pull/140/head
Jure Šorn 1 year ago
parent
commit
ab5baadb8c
2 changed files with 4 additions and 4 deletions
  1. 4
      README.md
  2. 4
      index.html

4
README.md

@ -2206,8 +2206,8 @@ delattr(<object>, '<attr_name>') # Same. Also `del <object>.<attr_name
<Sig> = inspect.signature(<function>) # Function's Signature object.
<dict> = <Sig>.parameters # Dict of Parameter objects.
<memb> = <Param>.kind # Member of ParameterKind enum.
<obj> = <Param>.default # Default value or <Param>.empty.
<type> = <Param>.annotation # Type or <Param>.empty.
<obj> = <Param>.default # Default value or Parameter.empty.
<type> = <Param>.annotation # Type or Parameter.empty.
```

4
index.html

@ -1820,8 +1820,8 @@ delattr(&lt;object&gt;, <span class="hljs-string">'&lt;attr_name&gt;'</span>)
<div><h3 id="parameters-1">Parameters</h3><pre><code class="python language-python hljs">&lt;Sig&gt; = inspect.signature(&lt;function&gt;) <span class="hljs-comment"># Function's Signature object.</span>
&lt;dict&gt; = &lt;Sig&gt;.parameters <span class="hljs-comment"># Dict of Parameter objects.</span>
&lt;memb&gt; = &lt;Param&gt;.kind <span class="hljs-comment"># Member of ParameterKind enum.</span>
&lt;obj&gt; = &lt;Param&gt;.default <span class="hljs-comment"># Default value or &lt;Param&gt;.empty.</span>
&lt;type&gt; = &lt;Param&gt;.annotation <span class="hljs-comment"># Type or &lt;Param&gt;.empty.</span>
&lt;obj&gt; = &lt;Param&gt;.default <span class="hljs-comment"># Default value or Parameter.empty.</span>
&lt;type&gt; = &lt;Param&gt;.annotation <span class="hljs-comment"># Type or Parameter.empty.</span>
</code></pre></div>
<div><h2 id="metaprogramming"><a href="#metaprogramming" name="metaprogramming">#</a>Metaprogramming</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">&lt;class&gt; = type(<span class="hljs-string">'&lt;class_name&gt;'</span>, &lt;tuple_of_parents&gt;, &lt;dict_of_class_attributes&gt;)</code></pre></div></div>

Loading…
Cancel
Save