where-to-go-from-here chapter

This commit is contained in:
Mark Pilgrim
2009-05-31 15:47:46 -07:00
parent 05911f25af
commit fa7a58a75e
9 changed files with 82 additions and 24 deletions
+2
View File
@@ -1,2 +1,4 @@
syntax: glob
*.pyc
build
grid28.gif
-2
View File
@@ -26,5 +26,3 @@ h1:before{content:""}
</ol>
<p>Send corrections and feedback to <a href=mailto:mark@diveintomark.org>mark@diveintomark.org</a>.
<p class=c>&copy; 2001&ndash;9 Mark Pilgrim
<script src=jquery.js></script>
<script src=dip3.js></script>
+2 -2
View File
@@ -5,7 +5,7 @@
<!--[if IE]><script src=html5.js></script><![endif]-->
<link rel=stylesheet href=dip3.css>
<style>
body{counter-reset:h1 20}
body{counter-reset:h1 19}
ins,del{line-height:2.154;text-decoration:none;font-style:normal;display:inline-block;width:100%}
ins{background:#9f9}
del{background:#f87}
@@ -1191,7 +1191,7 @@ tests\EUC-JP\arclamp.jp.xml EUC-JP with confide
<li>Test cases are essential. Don&#8217;t port anything without them. Don&#8217;t even try. The <em>only</em> reason I have any confidence at all that <code>chardet</code> works in Python 3 is because I had a test suite that exercised every line of code in the entire library. I <em>never</em> would have found half of these problems with manual spot-checking.
</ol>
<p class=nav><a rel=prev class=todo><span>&#x261C;</span></a> <a rel=next href=porting-code-to-python-3-with-2to3.html title="onward to &#8220;Porting Code to Python 3 with 2to3&#8221;"><span>&#x261E;</span></a>
<p class=nav><a rel=prev class=todo><span>&#x261C;</span></a> <a rel=next href=where-to-go-from-here.html title="onward to &#8220;Where To Go From Here&#8221;"><span>&#x261E;</span></a>
<p class=c>&copy; 2001&ndash;9 <a href=about.html>Mark Pilgrim</a>
<script src=jquery.js></script>
<script src=dip3.js></script>
+4 -2
View File
@@ -134,19 +134,21 @@ Content-Type: image/jpeg
The second time you request the same data, you include the ETag hash in an <code>If-None-Match</code> header of your request. If the data hasn&#8217;t changed, the server will send you back a <code>304</code> status code. As with the last-modified date checking, the server sends back <em>only</em> the <code>304</code> status code; it doesn&#8217;t send you the same data a second time. By including the ETag hash in your second request, you&#8217;re telling the server that there&#8217;s no need to re-send the same data if it still matches this hash, since <a href=#caching>you still have the data from the last time</a>.
<p>FIXME add curl example here
<p>Python&#8217;s <abbr>HTTP</abbr> libraries do not support ETags, but <code>httplib2</code> does.
<h3 id=compression>Compression</h3>
<p>When you talk about <abbr>HTTP</abbr> web services, you&#8217;re almost always talking about moving text-based data back and forth over the wire. Maybe it&#8217;s <abbr>XML</abbr>, maybe it&#8217;s <abbr>JSON</abbr>, maybe it&#8217;s just <a href=strings.html#boring-stuff title="there ain&#8217;t no such thing as plain text">plain text</a>. Regardless of the format, text compresses well. The example feed in <a href=xml.html>the XML chapter</a> is 3070 bytes uncompressed, but would be 941 bytes after gzip compression. That&#8217;s just 30% of the original size!
<p><abbr>HTTP</abbr> supports several compression algorithms. The two most common types are <a href=http://www.ietf.org/rfc/rfc1952.txt>gzip</a> and <a href=http://www.ietf.org/rfc/rfc1951.txt>deflate</a>. When you request a resource over <abbr>HTTP</abbr>, you can ask the server to send it in compressed format. You include an <code>Accept-encoding</code> header in your request, and if the server supports compression, it will send you back compressed data with a <code>Content-encoding</code> header that tells you which compression algorithm it used. Then it&#8217;s up to you to decompress the data.
<p><abbr>HTTP</abbr> supports several compression algorithms. The two most common types are <a href=http://www.ietf.org/rfc/rfc1952.txt>gzip</a> and <a href=http://www.ietf.org/rfc/rfc1951.txt>deflate</a>. When you request a resource over <abbr>HTTP</abbr>, you can ask the server to send it in compressed format. You include an <code>Accept-encoding</code> header in your request that lists which compression algorithms you support. If the server supports any of the same algorithms, it will send you back compressed data (with a <code>Content-encoding</code> header that tells you which algorithm it used). Then it&#8217;s up to you to decompress the data.
<p>Python&#8217;s <abbr>HTTP</abbr> libraries do not support compression, but <code>httplib2</code> does.
<h3 id=redirects>Redirects</h3>
<p><a href=http://www.w3.org/Provider/Style/URI>Cool URIs don&#8217;t change</a>, but many <abbr>URI</abbr>s are seriously uncool. Web sites get reorganized, pages move to new addresses. Even web services can reorganize. A syndicated feed at <code>http://example.com/index.xml</code> might be moved to <code>http://example.com/xml/atom.xml</code>. Or an entire domain might move, as an organization expands and reorganizes; <code>http://www.example.com/index.xml</code> becomes <code>http://server-farm-1.example.com/index.xml</code>.
<p><a href=http://www.w3.org/Provider/Style/URI>Cool <abbr>URI</abbr>s don&#8217;t change</a>, but many <abbr>URI</abbr>s are seriously uncool. Web sites get reorganized, pages move to new addresses. Even web services can reorganize. A syndicated feed at <code>http://example.com/index.xml</code> might be moved to <code>http://example.com/xml/atom.xml</code>. Or an entire domain might move, as an organization expands and reorganizes; <code>http://www.example.com/index.xml</code> becomes <code>http://server-farm-1.example.com/index.xml</code>.
<p>Every time you request any kind of resource from an <abbr>HTTP</abbr> server, the server includes a status code in its response. Status code <code>200</code> means &#8220;everything&#8217;s normal, here&#8217;s the page you asked for&#8221;. Status code <code>404</code> means &#8220;page not found&#8221;. (You&#8217;ve probably seen 404 errors while browsing the web.) Status codes in the 300&#8217;s indicate some form of redirection.
+1 -3
View File
@@ -45,8 +45,8 @@ h1:before{content:""}
<li class=todo>Performance tuning
<li class=todo>Packaging Python libraries
<li class=todo>Creating graphics with the Python Imaging Library
<li class=todo>Where to go from here
<li><a href=case-study-porting-chardet-to-python-3.html>Case Study: Porting <code>chardet</code> to Python 3</a>
<li><a href=where-to-go-from-here.html>Where to go from here</a>
<li id=a><a href=porting-code-to-python-3-with-2to3.html>Porting Code to Python 3 with <code>2to3</code></a>
<li id=b><a href=special-method-names.html>Special Method Names</a>
</ol>
@@ -60,5 +60,3 @@ h1:before{content:""}
<p class="c nm">This site is optimized for Lynx just because fuck you.<br>I&#8217;m told it also looks good in graphical browsers.
<p class=c>&copy; 2001&ndash;9 <a href=about.html>Mark Pilgrim</a>
<script src=jquery.js></script>
<script src=dip3.js></script>
+2 -1
View File
@@ -1118,7 +1118,8 @@ do_stuff(a_list)</code></pre>
do_stuff(a_list)</code></pre>
</table>
<p>FIXME: once the rest of the book is written, this appendix should contain copious links back to any chapter or section that touches on these features.
<p class=nav><a rel=prev href=case-study-porting-chardet-to-python-3.html title="back to &#8220;Case Study: Porting chardet to Python 3&#8221;"><span>&#x261C;</span></a> <a rel=next href=special-method-names.html title="onward to &#8220;Special Method Names&#8221;"><span>&#x261E;</span></a>
<p class=nav><a rel=prev href=where-to-go-from-here.html title="back to &#8220;Where To Go From Here&#8221;"><span>&#x261C;</span></a> <a rel=next href=special-method-names.html title="onward to &#8220;Special Method Names&#8221;"><span>&#x261E;</span></a>
<p class=c>&copy; 2001&ndash;9 <a href=about.html>Mark Pilgrim</a>
<script src=jquery.js></script>
<script src=dip3.js></script>
+1 -1
View File
@@ -815,7 +815,7 @@ def __exit__(self, *args) -> None:
<td><a href=http://docs.python.org/3.0/library/abc.html#abc.ABCMeta.__subclasshook__><code>MyABC.__subclasshook__(C)</code></a>
</table>
<p class=nav><a rel=prev href=porting-code-to-python-3-with-2to3.html title="back to &#8220;Porting code to Python 3 with 2to3&#8221;"><span>&#x261C;</span></a> <a rel=next class=todo><span>&#x261E;</span></a>
<p class=nav><a rel=prev href=porting-code-to-python-3-with-2to3.html title="back to &#8220;Porting code to Python 3 with 2to3&#8221;"><span>&#x261C;</span></a> <a rel=next href=further-further-reading.html title="onward to &#8220;Further Further Reading&#8221;"><span>&#x261E;</span></a>
<p class=c>&copy; 2001&ndash;9 <a href=about.html>Mark Pilgrim</a>
<script src=jquery.js></script>
<script src=dip3.js></script>
+1 -13
View File
@@ -276,18 +276,6 @@ ul li ol{margin:0;padding:0 0 0 2.5em}
<ol>
<li>...<a href=http://www.reddit.com/r/Python/comments/7sj39/dive_into_python_3/c07b3cq>will likely get ported in time</a>...
</ol>
<li>Where to go from here (tentative because most of these have not been ported to Python 3 yet)
<ol>
<li>WSGI
<li>Django
<li>Pylons
<li>TurboGears
<li>AppEngine
<li>IronPython
<li>Jython
<li>PyPy
<li>Stackless Python
</ol>
<li id=case-study-porting-chardet-to-python-3><a href=case-study-porting-chardet-to-python-3.html>Case study: porting <code>chardet</code> to Python 3</a>
<ol>
<li><a href=case-study-porting-chardet-to-python-3.html#divingin>Introducing <code>chardet</code>: a mini-FAQ</a>
@@ -318,6 +306,7 @@ ul li ol{margin:0;padding:0 0 0 2.5em}
</ol>
</ol>
<ul>
<li id=where-to-go-from-here><a href=where-to-go-from-here.html>Where to go from here</a>
<li id=porting-code-to-python-3-with-2to3><a href=porting-code-to-python-3-with-2to3.html>Appendix A. Porting code to Python 3 with <code>2to3</code></a>
<ol>
<li><a href=porting-code-to-python-3-with-2to3.html#divingin>Diving in</a>
@@ -400,7 +389,6 @@ ul li ol{margin:0;padding:0 0 0 2.5em}
<li>Set comprehensions
<li>Dictionary comprehensions
<li>Views (several dictionary methods return them, they're dynamic, update when the dictionary changes, etc.)
<li>Decorators
<li>Importing modules
<ol>
<li>...mention why from module import * is only allowed at module level
+69
View File
@@ -0,0 +1,69 @@
<!DOCTYPE html>
<head>
<meta charset=utf-8>
<title>Where to go from here - Dive into Python 3</title>
<!--[if IE]><script src=html5.js></script><![endif]-->
<link rel=stylesheet href=dip3.css>
<style>
body{counter-reset:h1 20}
</style>
<link rel=stylesheet media='only screen and (max-device-width: 480px)' href=mobile.css>
<link rel=stylesheet media=print href=print.css>
<meta name=viewport content='initial-scale=1.0'>
</head>
<form action=http://www.google.com/cse><div><input type=hidden name=cx value=014021643941856155761:l5eihuescdw><input type=hidden name=ie value=UTF-8>&nbsp;<input name=q size=25>&nbsp;<input type=submit name=sa value=Search></div></form>
<p>You are here: <a href=index.html>Home</a> <span>&#8227;</span> <a href=table-of-contents.html#where-to-go-from-here>Dive Into Python 3</a> <span>&#8227;</span>
<p id=level>Difficulty level: <span title=pro>&#x2666;&#x2666;&#x2666;&#x2666;&#x2666;</span>
<h1>Where To Go From Here</h1>
<blockquote class=q>
<p><span>&#x275D;</span> FIXME <span>&#x275E;</span><br>&mdash; FIXME
</blockquote>
<p id=toc>&nbsp;
<h2 id=furtherreading>Further Reading</h2>
<p class=f>There are a number of topics that I decided not to cover in this book, for which free tutorials exist.
<p>Decorators:
<ul>
<li><a href=http://programmingbits.pythonblogs.com/27_programmingbits/archive/50_function_decorators.html>Function Decorators</a>
<li><a href=http://programmingbits.pythonblogs.com/27_programmingbits/archive/51_more_on_function_decorators.html>More on Function Decorators</a>
<li><a href=http://www.ibm.com/developerworks/linux/library/l-cpdecor.html>Charming Python: Decorators make magic easy</a>
<li><a href=http://docs.python.org/reference/compound_stmts.html#function>Function Definitions</a> in the official Python documentation
</ul>
<p>Descriptors:
<ul>
<li><a href=http://users.rcn.com/python/download/Descriptor.htm>How-To Guide For Descriptors</a>
<li><a href=http://www.ibm.com/developerworks/linux/library/l-python-elegance-2.html>Charming Python: Python elegance and warts, Part 2</a>
<li><a href=http://www.informit.com/articles/printerfriendly.aspx?p=1309289>Python Descriptors</a>
<li><a href=http://docs.python.org/3.0/reference/datamodel.html#invoking-descriptors>Invoking Descriptors</a> in the official Python documentation
</ul>
<p>Metaclasses:
<ul>
<li><a href=http://www.ibm.com/developerworks/linux/library/l-pymeta.html>Metaclass programming in Python</a>
<li><a href=http://www.ibm.com/developerworks/linux/library/l-pymeta2/>Metaclass programming in Python, Part 2</a>
<li><a href=http://www.ibm.com/developerworks/linux/library/l-pymeta3.html>Metaclass programming in Python, Part 3</a>
</ul>
<p>Doug Hellman&#8217;s <a href=http://www.doughellmann.com/PyMOTW/contents.html>Python Module of the Week</a> is a fantastic guide to many of the modules in the Python standard library.
<h2 id=code>Where To Look For Python 3-Compatible Code</h2>
<p>As Python 3 is relatively new, there is a dearth of compatible libraries. Here are some of the places to look for code that works with Python 3.
<ul>
<li><a href="http://pypi.python.org/pypi?:action=browse&amp;c=533&amp;show=all">Python Package Index: list of Python 3 packages</a>
<li><a href="http://code.google.com/hosting/search?q=label:python3">Google Project Hosting: list of projects tagged &#8220;python3&#8221;</a>
<li><a href="http://sourceforge.net/search/?words=%22python+3%22">SourceForge: list of projects matching &#8220;Python 3&#8221;</a>
<li><a href="http://github.com/search?type=Repositories&amp;language=python&amp;q=python3">GitHub: list of projects matching &#8220;python3&#8221;</a> (also, <a href="http://github.com/search?type=Repositories&amp;language=python&amp;q=python+3">list of projects matching &#8220;python 3&#8221;</a>)
<li><a href="http://bitbucket.org/repo/all/?name=python3">BitBucket: list of projects matching &#8220;python3&#8221;</a> (and <a href="http://bitbucket.org/repo/all/?name=python+3">those matching &#8220;python 3&#8221;</a>)
</ul>
<p class=nav><a rel=prev href=case-study-porting-chardet-to-python-3.html title="back to &#8220;Case Study: Porting chardet to Python 3&#8221;"><span>&#x261C;</span></a> <a rel=next href=porting-code-to-python-3-with-2to3.html title="onward to &#8220;Porting Code to Python 3 with 2to3&#8221;"><span>&#x261E;</span></a>
<p class=c>&copy; 2001&ndash;9 <a href=about.html>Mark Pilgrim</a>
<script src=jquery.js></script>
<script src=dip3.js></script>