Skip to content

Commit 04e5b86

Browse files
committed
Introspection
1 parent 9488b1d commit 04e5b86

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2294,7 +2294,7 @@ CRITICAL:my_module:Running out of disk space.
22942294
Introspection
22952295
-------------
22962296
```python
2297-
<list> = dir() # List of of local names (including functions and classes).
2297+
<list> = dir() # List of local names (variables, funcs, classes, modules).
22982298
<dict> = vars() # Dict of local names and their objects. Also locals().
22992299
<dict> = globals() # Dict of global names (for instance '__builtin__' module).
23002300
```
@@ -2304,7 +2304,7 @@ Introspection
23042304
<dict> = vars(<obj>) # Returns dict of writable attributes. Also <obj>.__dict__.
23052305
<bool> = hasattr(<obj>, '<name>') # Checks if object possesses attribute with passed name.
23062306
value = getattr(<obj>, '<name>') # Returns object's attribute or raises AttributeError.
2307-
setattr(<obj>, '<name>', value) # Sets attribute. Only works on objects with __dict__.
2307+
setattr(<obj>, '<name>', value) # Sets attribute. Only works on objects with __dict__ attr.
23082308
delattr(<obj>, '<name>') # Deletes attribute from __dict__. Also `del <obj>.<name>`.
23092309
```
23102310

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
18771877
2023-02-07 23:21:01,430 CRITICAL:my_module:Running out of disk space.
18781878
</code></pre></div>
18791879

1880-
<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 of local names (including functions and classes).</span>
1880+
<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>
18821882
&lt;dict&gt; = globals() <span class="hljs-comment"># Dict of global names (for instance '__builtin__' module).</span>
18831883
</code></pre></div>
@@ -1886,7 +1886,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment
18861886
&lt;dict&gt; = vars(&lt;obj&gt;) <span class="hljs-comment"># Returns dict of writable attributes. Also &lt;obj&gt;.__dict__.</span>
18871887
&lt;bool&gt; = hasattr(&lt;obj&gt;, <span class="hljs-string">'&lt;name&gt;'</span>) <span class="hljs-comment"># Checks if object possesses attribute with passed name.</span>
18881888
value = getattr(&lt;obj&gt;, <span class="hljs-string">'&lt;name&gt;'</span>) <span class="hljs-comment"># Returns object's attribute or raises AttributeError.</span>
1889-
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__.</span>
1889+
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>
18921892
<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>

0 commit comments

Comments
 (0)