mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
where-to-go-from-here chapter
This commit is contained in:
@@ -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>© 2001–9 Mark Pilgrim
|
||||
<script src=jquery.js></script>
|
||||
<script src=dip3.js></script>
|
||||
|
||||
@@ -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’t port anything without them. Don’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>☜</span></a> <a rel=next href=porting-code-to-python-3-with-2to3.html title="onward to “Porting Code to Python 3 with 2to3”"><span>☞</span></a>
|
||||
<p class=nav><a rel=prev class=todo><span>☜</span></a> <a rel=next href=where-to-go-from-here.html title="onward to “Where To Go From Here”"><span>☞</span></a>
|
||||
<p class=c>© 2001–9 <a href=about.html>Mark Pilgrim</a>
|
||||
<script src=jquery.js></script>
|
||||
<script src=dip3.js></script>
|
||||
|
||||
@@ -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’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’t send you the same data a second time. By including the ETag hash in your second request, you’re telling the server that there’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’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’re almost always talking about moving text-based data back and forth over the wire. Maybe it’s <abbr>XML</abbr>, maybe it’s <abbr>JSON</abbr>, maybe it’s just <a href=strings.html#boring-stuff title="there ain’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’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’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’s up to you to decompress the data.
|
||||
|
||||
<p>Python’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’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’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 “everything’s normal, here’s the page you asked for”. Status code <code>404</code> means “page not found”. (You’ve probably seen 404 errors while browsing the web.) Status codes in the 300’s indicate some form of redirection.
|
||||
|
||||
|
||||
+1
-3
@@ -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’m told it also looks good in graphical browsers.
|
||||
|
||||
<p class=c>© 2001–9 <a href=about.html>Mark Pilgrim</a>
|
||||
<script src=jquery.js></script>
|
||||
<script src=dip3.js></script>
|
||||
|
||||
@@ -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 “Case Study: Porting chardet to Python 3”"><span>☜</span></a> <a rel=next href=special-method-names.html title="onward to “Special Method Names”"><span>☞</span></a>
|
||||
|
||||
<p class=nav><a rel=prev href=where-to-go-from-here.html title="back to “Where To Go From Here”"><span>☜</span></a> <a rel=next href=special-method-names.html title="onward to “Special Method Names”"><span>☞</span></a>
|
||||
<p class=c>© 2001–9 <a href=about.html>Mark Pilgrim</a>
|
||||
<script src=jquery.js></script>
|
||||
<script src=dip3.js></script>
|
||||
|
||||
@@ -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 “Porting code to Python 3 with 2to3”"><span>☜</span></a> <a rel=next class=todo><span>☞</span></a>
|
||||
<p class=nav><a rel=prev href=porting-code-to-python-3-with-2to3.html title="back to “Porting code to Python 3 with 2to3”"><span>☜</span></a> <a rel=next href=further-further-reading.html title="onward to “Further Further Reading”"><span>☞</span></a>
|
||||
<p class=c>© 2001–9 <a href=about.html>Mark Pilgrim</a>
|
||||
<script src=jquery.js></script>
|
||||
<script src=dip3.js></script>
|
||||
|
||||
+1
-13
@@ -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
|
||||
|
||||
@@ -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> <input name=q size=25> <input type=submit name=sa value=Search></div></form>
|
||||
<p>You are here: <a href=index.html>Home</a> <span>‣</span> <a href=table-of-contents.html#where-to-go-from-here>Dive Into Python 3</a> <span>‣</span>
|
||||
<p id=level>Difficulty level: <span title=pro>♦♦♦♦♦</span>
|
||||
<h1>Where To Go From Here</h1>
|
||||
<blockquote class=q>
|
||||
<p><span>❝</span> FIXME <span>❞</span><br>— FIXME
|
||||
</blockquote>
|
||||
<p id=toc>
|
||||
<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’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&c=533&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 “python3”</a>
|
||||
<li><a href="http://sourceforge.net/search/?words=%22python+3%22">SourceForge: list of projects matching “Python 3”</a>
|
||||
<li><a href="http://github.com/search?type=Repositories&language=python&q=python3">GitHub: list of projects matching “python3”</a> (also, <a href="http://github.com/search?type=Repositories&language=python&q=python+3">list of projects matching “python 3”</a>)
|
||||
<li><a href="http://bitbucket.org/repo/all/?name=python3">BitBucket: list of projects matching “python3”</a> (and <a href="http://bitbucket.org/repo/all/?name=python+3">those matching “python 3”</a>)
|
||||
</ul>
|
||||
|
||||
<p class=nav><a rel=prev href=case-study-porting-chardet-to-python-3.html title="back to “Case Study: Porting chardet to Python 3”"><span>☜</span></a> <a rel=next href=porting-code-to-python-3-with-2to3.html title="onward to “Porting Code to Python 3 with 2to3”"><span>☞</span></a>
|
||||
|
||||
<p class=c>© 2001–9 <a href=about.html>Mark Pilgrim</a>
|
||||
<script src=jquery.js></script>
|
||||
<script src=dip3.js></script>
|
||||
Reference in New Issue
Block a user