Browse Source

Introspection

pull/187/head
Jure Šorn 10 months ago
parent
commit
4987fa8f9e
2 changed files with 10 additions and 10 deletions
  1. 10
      README.md
  2. 10
      index.html

10
README.md

@ -2296,11 +2296,11 @@ delattr(<object>, '<attr_name>') # Same. Also `del <object>.<attr_name
``` ```
```python ```python
<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 Parameter.empty.
<type> = <Param>.annotation # Type or Parameter.empty.
<Sig> = inspect.signature(<function>) # Returns function's Signature object.
<dict> = <Sig>.parameters # Dict of Parameter objects. Also <Sig>.return_type.
<memb> = <Param>.kind # Member of ParameterKind enum (KEYWORD_ONLY, ...).
<obj> = <Param>.default # Returns param's default value or Parameter.empty.
<type> = <Param>.annotation # Returns param's type hint or Parameter.empty.
``` ```

10
index.html

@ -1894,11 +1894,11 @@ value = getattr(&lt;object&gt;, <span class="hljs-string">'&lt;attr_name&gt;'</
setattr(&lt;object&gt;, <span class="hljs-string">'&lt;attr_name&gt;'</span>, value) <span class="hljs-comment"># Only works on objects with __dict__ attribute.</span> setattr(&lt;object&gt;, <span class="hljs-string">'&lt;attr_name&gt;'</span>, value) <span class="hljs-comment"># Only works on objects with __dict__ attribute.</span>
delattr(&lt;object&gt;, <span class="hljs-string">'&lt;attr_name&gt;'</span>) <span class="hljs-comment"># Same. Also `del &lt;object&gt;.&lt;attr_name&gt;`.</span> delattr(&lt;object&gt;, <span class="hljs-string">'&lt;attr_name&gt;'</span>) <span class="hljs-comment"># Same. Also `del &lt;object&gt;.&lt;attr_name&gt;`.</span>
</code></pre> </code></pre>
<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 Parameter.empty.</span>
&lt;type&gt; = &lt;Param&gt;.annotation <span class="hljs-comment"># Type or Parameter.empty.</span>
<pre><code class="python language-python hljs">&lt;Sig&gt; = inspect.signature(&lt;function&gt;) <span class="hljs-comment"># Returns function's Signature object.</span>
&lt;dict&gt; = &lt;Sig&gt;.parameters <span class="hljs-comment"># Dict of Parameter objects. Also &lt;Sig&gt;.return_type.</span>
&lt;memb&gt; = &lt;Param&gt;.kind <span class="hljs-comment"># Member of ParameterKind enum (KEYWORD_ONLY, ...).</span>
&lt;obj&gt; = &lt;Param&gt;.default <span class="hljs-comment"># Returns param's default value or Parameter.empty.</span>
&lt;type&gt; = &lt;Param&gt;.annotation <span class="hljs-comment"># Returns param's type hint or Parameter.empty.</span>
</code></pre> </code></pre>
<div><h2 id="coroutines"><a href="#coroutines" name="coroutines">#</a>Coroutines</h2><ul> <div><h2 id="coroutines"><a href="#coroutines" name="coroutines">#</a>Coroutines</h2><ul>
<li><strong>Coroutines have a lot in common with threads, but unlike threads, they only give up control when they call another coroutine and they don’t use as much memory.</strong></li> <li><strong>Coroutines have a lot in common with threads, but unlike threads, they only give up control when they call another coroutine and they don’t use as much memory.</strong></li>

Loading…
Cancel
Save