|
|
@ -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) |
|
|
|