|
1880 | 1880 | <dict> = vars(<object>) <span class="hljs-comment"># Dict of object's fields. Also <obj>.__dict__.</span>
|
1881 | 1881 | </code></pre></div>
|
1882 | 1882 |
|
1883 |
| -<pre><code class="python language-python hljs"><bool> = hasattr(<object>, <span class="hljs-string">'<attr_name>'</span>) |
1884 |
| -value = getattr(<object>, <span class="hljs-string">'<attr_name>'</span>) |
1885 |
| -setattr(<object>, <span class="hljs-string">'<attr_name>'</span>, value) |
1886 |
| -delattr(<object>, <span class="hljs-string">'<attr_name>'</span>) |
| 1883 | +<pre><code class="python language-python hljs"><bool> = hasattr(<object>, <span class="hljs-string">'<attr_name>'</span>) <span class="hljs-comment"># Checks if getattr raises an error.</span> |
| 1884 | +value = getattr(<object>, <span class="hljs-string">'<attr_name>'</span>) <span class="hljs-comment"># Raises AttributeError if attribute is missing.</span> |
| 1885 | +setattr(<object>, <span class="hljs-string">'<attr_name>'</span>, value) <span class="hljs-comment"># Only works on user-defined classes.</span> |
| 1886 | +delattr(<object>, <span class="hljs-string">'<attr_name>'</span>) <span class="hljs-comment"># Equivalent to `del <object>.<attr_name>`.</span> |
1887 | 1887 | </code></pre>
|
1888 | 1888 | <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
|
1889 | 1889 | <sig> = signature(<function>)
|
|
2061 | 2061 | curs_set(<span class="hljs-number">0</span>) <span class="hljs-comment"># Makes cursor invisible.</span>
|
2062 | 2062 | screen.nodelay(<span class="hljs-keyword">True</span>) <span class="hljs-comment"># Makes getch() non-blocking.</span>
|
2063 | 2063 | screen.clear()
|
2064 |
| - screen.addstr(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-string">'Press ESC to quit.'</span>) |
| 2064 | + screen.addstr(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-string">'Press ESC to quit.'</span>) <span class="hljs-comment"># Coordinates are y, x.</span> |
2065 | 2065 | <span class="hljs-keyword">while</span> screen.getch() != ascii.ESC:
|
2066 | 2066 | <span class="hljs-keyword">pass</span>
|
2067 | 2067 |
|
|
0 commit comments