diff --git a/README.md b/README.md index 7e4bf54..29b866f 100644 --- a/README.md +++ b/README.md @@ -2140,6 +2140,9 @@ Introspection ```python <list> = dir(<object>) # Names of object's attributes (incl. methods). <dict> = vars(<object>) # Dict of object's fields. Also <obj>.__dict__. +``` + +```python <bool> = hasattr(<object>, '<attr_name>') value = getattr(<object>, '<attr_name>') setattr(<object>, '<attr_name>', value) diff --git a/index.html b/index.html index 240e757..4fd7c10 100644 --- a/index.html +++ b/index.html @@ -1876,12 +1876,13 @@ last_el = op.methodcaller(<span class="hljs-string">'pop'</span>)(<l <div><h3 id="attributes-1">Attributes</h3><pre><code class="python language-python hljs"><list> = dir(<object>) <span class="hljs-comment"># Names of object's attributes (incl. methods).</span> <dict> = vars(<object>) <span class="hljs-comment"># Dict of object's fields. Also <obj>.__dict__.</span> -<bool> = hasattr(<object>, <span class="hljs-string">'<attr_name>'</span>) +</code></pre></div> + +<pre><code class="python language-python hljs"><bool> = hasattr(<object>, <span class="hljs-string">'<attr_name>'</span>) value = getattr(<object>, <span class="hljs-string">'<attr_name>'</span>) setattr(<object>, <span class="hljs-string">'<attr_name>'</span>, value) delattr(<object>, <span class="hljs-string">'<attr_name>'</span>) -</code></pre></div> - +</code></pre> <div><h3 id="parameters-1">Parameters</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> inspect <span class="hljs-keyword">import</span> signature <sig> = signature(<function>) no_of_params = len(<sig>.parameters) diff --git a/pdf/descripitive image_final-01.png b/pdf/descripitive_image_final-01.png similarity index 100% rename from pdf/descripitive image_final-01.png rename to pdf/descripitive_image_final-01.png diff --git a/pdf/descripitive image_final.png b/pdf/descripitive_image_final.png similarity index 100% rename from pdf/descripitive image_final.png rename to pdf/descripitive_image_final.png