You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<div><h2id="introspection"><ahref="#introspection" name="introspection">#</a>Introspection</h2><pre><codeclass="python language-python hljs"><list> = dir() <spanclass="hljs-comment"># List of local names (variables, funcs, classes, modules).</span>
1881
1881
<dict> = vars() <spanclass="hljs-comment"># Dict of local names and their objects. Also locals().</span>
1882
-
<dict> = globals() <spanclass="hljs-comment"># Dict of global names (for instance '__builtin__' module).</span>
1882
+
<dict> = globals() <spanclass="hljs-comment"># Dict of global names and their objects, e.g. __builtin__.</span>
1883
1883
</code></pre></div>
1884
1884
1885
1885
<pre><codeclass="python language-python hljs"><list> = dir(<obj>) <spanclass="hljs-comment"># Returns names of all object's attributes (incl. methods).</span>
setattr(<obj>, <spanclass="hljs-string">'<name>'</span>, value) <spanclass="hljs-comment"># Sets attribute. Only works on objects with __dict__ attr.</span>
1890
1890
delattr(<obj>, <spanclass="hljs-string">'<name>'</span>) <spanclass="hljs-comment"># Deletes attribute from __dict__. Also `del <obj>.<name>`.</span>
1891
1891
</code></pre>
1892
-
<pre><codeclass="python language-python hljs"><Sig> = inspect.signature(<func>) <spanclass="hljs-comment"># Returns function's Signature object. Can accept a class.</span>
1892
+
<pre><codeclass="python language-python hljs"><Sig> = inspect.signature(<func>) <spanclass="hljs-comment"># Returns a Signature object of the passed function.</span>
1893
1893
<dict> = <Sig>.parameters <spanclass="hljs-comment"># Returns dict of Parameters. Also <Sig>.return_annotation.</span>
1894
1894
<memb> = <Param>.kind <spanclass="hljs-comment"># Returns ParameterKind member (Parameter.KEYWORD_ONLY, …).</span>
1895
1895
<type> = <Param>.annotation <spanclass="hljs-comment"># Returns Parameter.empty if missing. Also <Param>.default.</span>
0 commit comments