<dict> = vars(<object>) <spanclass="hljs-comment"># Dict of object's fields. Also <obj>.__dict__.</span>
</code></pre></div>
<pre><codeclass="python language-python hljs"><bool> = hasattr(<object>, <spanclass="hljs-string">'<attr_name>'</span>) <spanclass="hljs-comment"># Checks if getattr raises an error.</span>
<pre><codeclass="python language-python hljs"><bool> = hasattr(<object>, <spanclass="hljs-string">'<attr_name>'</span>) <spanclass="hljs-comment"># Checks if getattr() raises an error.</span>
value = getattr(<object>, <spanclass="hljs-string">'<attr_name>'</span>) <spanclass="hljs-comment"># Raises AttributeError if attribute is missing.</span>
setattr(<object>, <spanclass="hljs-string">'<attr_name>'</span>, value) <spanclass="hljs-comment"># Only works on user-defined classes.</span>
delattr(<object>, <spanclass="hljs-string">'<attr_name>'</span>) <spanclass="hljs-comment"># Equivalent to `del <object>.<attr_name>`.</span>