Skip to content

Commit 37d367c

Browse files
committed
Introspection
1 parent 04e5b86 commit 37d367c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,7 +2296,7 @@ Introspection
22962296
```python
22972297
<list> = dir() # List of local names (variables, funcs, classes, modules).
22982298
<dict> = vars() # Dict of local names and their objects. Also locals().
2299-
<dict> = globals() # Dict of global names (for instance '__builtin__' module).
2299+
<dict> = globals() # Dict of global names and their objects, e.g. __builtin__.
23002300
```
23012301

23022302
```python
@@ -2309,7 +2309,7 @@ delattr(<obj>, '<name>') # Deletes attribute from __dict__. Also `del
23092309
```
23102310

23112311
```python
2312-
<Sig> = inspect.signature(<func>) # Returns function's Signature object. Can accept a class.
2312+
<Sig> = inspect.signature(<func>) # Returns a Signature object of the passed function.
23132313
<dict> = <Sig>.parameters # Returns dict of Parameters. Also <Sig>.return_annotation.
23142314
<memb> = <Param>.kind # Returns ParameterKind member (Parameter.KEYWORD_ONLY, …).
23152315
<type> = <Param>.annotation # Returns Parameter.empty if missing. Also <Param>.default.

index.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
<body>
5757
<header>
58-
<aside>November 26, 2024</aside>
58+
<aside>November 27, 2024</aside>
5959
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
6060
</header>
6161

@@ -1879,7 +1879,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
18791879

18801880
<div><h2 id="introspection"><a href="#introspection" name="introspection">#</a>Introspection</h2><pre><code class="python language-python hljs">&lt;list&gt; = dir() <span class="hljs-comment"># List of local names (variables, funcs, classes, modules).</span>
18811881
&lt;dict&gt; = vars() <span class="hljs-comment"># Dict of local names and their objects. Also locals().</span>
1882-
&lt;dict&gt; = globals() <span class="hljs-comment"># Dict of global names (for instance '__builtin__' module).</span>
1882+
&lt;dict&gt; = globals() <span class="hljs-comment"># Dict of global names and their objects, e.g. __builtin__.</span>
18831883
</code></pre></div>
18841884

18851885
<pre><code class="python language-python hljs">&lt;list&gt; = dir(&lt;obj&gt;) <span class="hljs-comment"># Returns names of all object's attributes (incl. methods).</span>
@@ -1889,7 +1889,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
18891889
setattr(&lt;obj&gt;, <span class="hljs-string">'&lt;name&gt;'</span>, value) <span class="hljs-comment"># Sets attribute. Only works on objects with __dict__ attr.</span>
18901890
delattr(&lt;obj&gt;, <span class="hljs-string">'&lt;name&gt;'</span>) <span class="hljs-comment"># Deletes attribute from __dict__. Also `del &lt;obj&gt;.&lt;name&gt;`.</span>
18911891
</code></pre>
1892-
<pre><code class="python language-python hljs">&lt;Sig&gt; = inspect.signature(&lt;func&gt;) <span class="hljs-comment"># Returns function's Signature object. Can accept a class.</span>
1892+
<pre><code class="python language-python hljs">&lt;Sig&gt; = inspect.signature(&lt;func&gt;) <span class="hljs-comment"># Returns a Signature object of the passed function.</span>
18931893
&lt;dict&gt; = &lt;Sig&gt;.parameters <span class="hljs-comment"># Returns dict of Parameters. Also &lt;Sig&gt;.return_annotation.</span>
18941894
&lt;memb&gt; = &lt;Param&gt;.kind <span class="hljs-comment"># Returns ParameterKind member (Parameter.KEYWORD_ONLY, …).</span>
18951895
&lt;type&gt; = &lt;Param&gt;.annotation <span class="hljs-comment"># Returns Parameter.empty if missing. Also &lt;Param&gt;.default.</span>
@@ -2923,7 +2923,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
29232923

29242924

29252925
<footer>
2926-
<aside>November 26, 2024</aside>
2926+
<aside>November 27, 2024</aside>
29272927
<a href="https://gto76.github.io" rel="author">Jure Šorn</a>
29282928
</footer>
29292929

0 commit comments

Comments
 (0)