|
1322 | 1322 |
|
1323 | 1323 | <ul> |
1324 | 1324 | <li><strong>Use <code class="python hljs"><span class="hljs-string">'help=<str>'</span></code> to set argument description that will be displayed in help message.</strong></li> |
1325 | | -<li><strong>Use <code class="python hljs"><span class="hljs-string">'default=<el>'</span></code> to set the default value.</strong></li> |
| 1325 | +<li><strong>Use <code class="python hljs"><span class="hljs-string">'default=<el>'</span></code> to set argument's default value.</strong></li> |
1326 | 1326 | <li><strong>Use <code class="python hljs"><span class="hljs-string">'type=FileType(<mode>)'</span></code> for files. Accepts 'encoding', but 'newline' is None.</strong></li> |
1327 | 1327 | </ul> |
1328 | 1328 | <div><h2 id="open"><a href="#open" name="open">#</a>Open</h2><p><strong>Opens the file and returns a corresponding file object.</strong></p><pre><code class="python language-python hljs"><file> = open(<path>, mode=<span class="hljs-string">'r'</span>, encoding=<span class="hljs-keyword">None</span>, newline=<span class="hljs-keyword">None</span>) |
@@ -1800,15 +1800,15 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
1800 | 1800 | first_element = op.methodcaller(<span class="hljs-string">'pop'</span>, <span class="hljs-number">0</span>)(<list>) |
1801 | 1801 | </code></pre> |
1802 | 1802 | <ul> |
1803 | | -<li><strong>Bitwise operators require objects to have and(), or() and xor() special methods, unlike logical operators that work on all types of objects.</strong></li> |
| 1803 | +<li><strong>Bitwise operators require objects to have and(), or(), xor() and invert() special methods, unlike logical operators that work on all types of objects.</strong></li> |
1804 | 1804 | <li><strong>Also: <code class="python hljs"><span class="hljs-string">'<bool> = <bool> &|^ <bool>'</span></code> and <code class="python hljs"><span class="hljs-string">'<int> = <bool> &|^ <int>'</span></code>.</strong></li> |
1805 | 1805 | </ul> |
1806 | 1806 | <div><h2 id="introspection"><a href="#introspection" name="introspection">#</a>Introspection</h2><pre><code class="python language-python hljs"><list> = dir() <span class="hljs-comment"># Names of local variables, functions, classes, etc.</span> |
1807 | 1807 | <dict> = vars() <span class="hljs-comment"># Dict of local variables, etc. Also locals().</span> |
1808 | 1808 | <dict> = globals() <span class="hljs-comment"># Dict of global vars, etc. (incl. '__builtins__').</span> |
1809 | 1809 | </code></pre></div> |
1810 | 1810 |
|
1811 | | -<div><h3 id="attributes">Attributes</h3><pre><code class="python language-python hljs"><list> = dir(<object>) <span class="hljs-comment"># Names of object's attributes (incl. methods).</span> |
| 1811 | +<div><h3 id="attributes">Attributes</h3><pre><code class="python language-python hljs"><list> = dir(<object>) <span class="hljs-comment"># Names of object's attributes (including methods).</span> |
1812 | 1812 | <dict> = vars(<object>) <span class="hljs-comment"># Dict of writable attributes. Also <obj>.__dict__.</span> |
1813 | 1813 | <bool> = hasattr(<object>, <span class="hljs-string">'<attr_name>'</span>) <span class="hljs-comment"># Checks if getattr() raises an AttributeError.</span> |
1814 | 1814 | value = getattr(<object>, <span class="hljs-string">'<attr_name>'</span>) <span class="hljs-comment"># Raises AttributeError if attribute is missing.</span> |
@@ -2106,7 +2106,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
2106 | 2106 | <span class="hljs-keyword">return</span> {<span class="hljs-string">'team'</span>: team, <span class="hljs-string">'odds'</span>: [<span class="hljs-number">2.09</span>, <span class="hljs-number">3.74</span>, <span class="hljs-number">3.68</span>]} |
2107 | 2107 | </code></pre></div> |
2108 | 2108 |
|
2109 | | -<div><h4 id="startstheappinitsownthreadandqueriesitwithapostrequest">Starts the app in its own thread and queries it with a post request:</h4><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install requests</span> |
| 2109 | +<div><h4 id="startstheappinitsownthreadandqueriesitsrestapi">Starts the app in its own thread and queries its REST API:</h4><pre><code class="python language-python hljs"><span class="hljs-comment"># $ pip3 install requests</span> |
2110 | 2110 | <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> threading, requests |
2111 | 2111 | <span class="hljs-meta">>>> </span>threading.Thread(target=app.run, daemon=<span class="hljs-keyword">True</span>).start() |
2112 | 2112 | <span class="hljs-meta">>>> </span>url = <span class="hljs-string">'http://localhost:5000/football/odds'</span> |
@@ -2588,7 +2588,7 @@ <h3 id="format-2">Format</h3><div><h4 id="forstandardtypesizesandmanualalignment |
2588 | 2588 | <pre><code class="python language-python hljs"><Sr> = <Sr> > <el/Sr> <span class="hljs-comment"># Returns a Series of bools.</span> |
2589 | 2589 | <Sr> = <Sr> + <el/Sr> <span class="hljs-comment"># Items with non-matching keys get value NaN.</span> |
2590 | 2590 | </code></pre> |
2591 | | -<pre><code class="python language-python hljs"><Sr> = pd.concat(<coll_of_Sr>) <span class="hljs-comment"># Concats multiple Series into one long Series.</span> |
| 2591 | +<pre><code class="python language-python hljs"><Sr> = pd.concat(<coll_of_Sr>) <span class="hljs-comment"># Concats multiple series into one long Series.</span> |
2592 | 2592 | <Sr> = <Sr>.combine_first(<Sr>) <span class="hljs-comment"># Adds items that are not yet present.</span> |
2593 | 2593 | <Sr>.update(<Sr>) <span class="hljs-comment"># Updates items that are already present.</span> |
2594 | 2594 | </code></pre> |
|
0 commit comments