diff --git a/README.md b/README.md index 3266166..926e2c4 100644 --- a/README.md +++ b/README.md @@ -2294,7 +2294,7 @@ CRITICAL:my_module:Running out of disk space. Introspection ------------- ```python -<list> = dir() # List of of local names (including functions and classes). +<list> = dir() # List of local names (variables, funcs, classes, modules). <dict> = vars() # Dict of local names and their objects. Also locals(). <dict> = globals() # Dict of global names (for instance '__builtin__' module). ``` @@ -2304,7 +2304,7 @@ Introspection <dict> = vars(<obj>) # Returns dict of writable attributes. Also <obj>.__dict__. <bool> = hasattr(<obj>, '<name>') # Checks if object possesses attribute with passed name. value = getattr(<obj>, '<name>') # Returns object's attribute or raises AttributeError. -setattr(<obj>, '<name>', value) # Sets attribute. Only works on objects with __dict__. +setattr(<obj>, '<name>', value) # Sets attribute. Only works on objects with __dict__ attr. delattr(<obj>, '<name>') # Deletes attribute from __dict__. Also `del <obj>.<name>`. ``` diff --git a/index.html b/index.html index f206fa8..56e24fc 100644 --- a/index.html +++ b/index.html @@ -1877,7 +1877,7 @@ CRITICAL:my_module:Running out of disk space. 2023-02-07 23:21:01,430 CRITICAL:my_module:Running out of disk space. </code></pre></div> -<div><h2 id="introspection"><a href="#introspection" name="introspection">#</a>Introspection</h2><pre><code class="python language-python hljs"><list> = dir() <span class="hljs-comment"># List of of local names (including functions and classes).</span> +<div><h2 id="introspection"><a href="#introspection" name="introspection">#</a>Introspection</h2><pre><code class="python language-python hljs"><list> = dir() <span class="hljs-comment"># List of local names (variables, funcs, classes, modules).</span> <dict> = vars() <span class="hljs-comment"># Dict of local names and their objects. Also locals().</span> <dict> = globals() <span class="hljs-comment"># Dict of global names (for instance '__builtin__' module).</span> </code></pre></div> @@ -1886,7 +1886,7 @@ CRITICAL:my_module:Running out of disk space. <dict> = vars(<obj>) <span class="hljs-comment"># Returns dict of writable attributes. Also <obj>.__dict__.</span> <bool> = hasattr(<obj>, <span class="hljs-string">'<name>'</span>) <span class="hljs-comment"># Checks if object possesses attribute with passed name.</span> value = getattr(<obj>, <span class="hljs-string">'<name>'</span>) <span class="hljs-comment"># Returns object's attribute or raises AttributeError.</span> -setattr(<obj>, <span class="hljs-string">'<name>'</span>, value) <span class="hljs-comment"># Sets attribute. Only works on objects with __dict__.</span> +setattr(<obj>, <span class="hljs-string">'<name>'</span>, value) <span class="hljs-comment"># Sets attribute. Only works on objects with __dict__ attr.</span> delattr(<obj>, <span class="hljs-string">'<name>'</span>) <span class="hljs-comment"># Deletes attribute from __dict__. Also `del <obj>.<name>`.</span> </code></pre> <pre><code class="python language-python hljs"><Sig> = inspect.signature(<func>) <span class="hljs-comment"># Returns function's Signature object. Can accept a class.</span>