build fiddling

This commit is contained in:
Mark Pilgrim
2009-06-09 13:07:05 -04:00
parent c6cb3c5db0
commit 8357efb7ad
3 changed files with 12 additions and 2 deletions
+1 -1
View File
@@ -209,7 +209,7 @@ Cache-Control: max-age=31536000, public</samp></pre>
<h2 id=whats-on-the-wire>What&#8217;s On The Wire?</h2>
<p>To see why this is inefficient and rude, let&#8217;s turn on the debugging features of Python&#8217;s <abbr>HTTP</abbr> library and see what&#8217;s being sent &#8220;on the wire.&#8221;
<p>To see why this is inefficient and rude, let&#8217;s turn on the debugging features of Python&#8217;s <abbr>HTTP</abbr> library and see what&#8217;s being sent &#8220;on the wire&#8221; (<i>i.e.</i> over the network).
<pre class=screen>
<samp class=p>>>> </samp><kbd class=pp>from http.client import HTTPConnection</kbd>
+10
View File
@@ -1,4 +1,14 @@
#!/bin/sh
die () {
echo "$1" >/dev/stderr
exit 1
}
hg status|grep "^\?" && die "Stray files found."
echo "running unit tests"
cd examples/
python3 regression.py
cd ..
ssh diveintomark.org "hg -R /home/mark/db/diveintopython3/ serve --stdio" &
hg push ssh://mark@diveintomark.org//home/mark/db/diveintopython3/
+1 -1
View File
@@ -134,7 +134,7 @@ SyntaxError: non-keyword arg after keyword arg</samp></pre>
<p class=a>&#x2042;
<h2 id=readability>Writing Readable Code</h2>
<p>I won&#8217;t bore you with a long finger-wagging speech about the importance of documenting your code. Just know that code is written once but read many times, and the most important audience for your code is yourself, six months after writing it (i.e. after you&#8217;ve forgotten everything but need to fix something). Python makes it easy to write readable code, so take advantage of it. You&#8217;ll thank me in six months.
<p>I won&#8217;t bore you with a long finger-wagging speech about the importance of documenting your code. Just know that code is written once but read many times, and the most important audience for your code is yourself, six months after writing it (<i>i.e.</i> after you&#8217;ve forgotten everything but need to fix something). Python makes it easy to write readable code, so take advantage of it. You&#8217;ll thank me in six months.
<h3 id=docstrings>Documentation Strings</h3>
<p>You can document a Python function by giving it a documentation string (<code>docstring</code> for short). In this program, the <code>approximate_size()</code> function has a <code>docstring</code>:
<pre><code class=pp>def approximate_size(size, a_kilobyte_is_1024_bytes=True):