Files
dive-into-python3/table-of-contents.html
T
2009-03-13 21:28:36 -04:00

354 lines
16 KiB
HTML

<!DOCTYPE html>
<html lang=en>
<head>
<meta charset=utf-8>
<title>Table of contents - Dive Into Python 3</title>
<!--[if IE]><script src=html5.js></script><![endif]-->
<link rel="shortcut icon" href=data:image/ico,>
<link rel=alternate type=application/atom+xml href=http://hg.diveintopython3.org/atom-log>
<link rel=stylesheet type=text/css href=dip3.css>
<style>
h1:before{content:""}
ol,ul{font-weight:bold}
li ol{font-weight:normal}
ul{list-style:none;margin:0;padding:0}
ul li ol{margin:0;padding:0 0 0 2.5em}
</style>
</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=31>&nbsp;<input type=submit name=sa value=Search></div></form>
<p class=nav>You are here: <a href=/>Home</a> <span>&#8227;</span> Dive Into Python 3 <span>&#8227;</span>
<h1>Table of contents</h1>
<ol start=0>
<li>Installing Python
<ol>
<li>Python on Windows
<li>Python on Mac OS X
<li>Python on Ubuntu Linux
<li>Python from source
<li>The interactive shell
</ol>
<li id=your-first-python-program><a href=your-first-python-program.html>Your first Python program</a>
<ol>
<li><a href=your-first-python-program.html#divingin>Diving in</a>
<li><a href=your-first-python-program.html#declaringfunctions>Declaring functions</a>
<li><a href=your-first-python-program.html#readability>Writing readable code</a>
<ol>
<li><a href=your-first-python-program.html#docstrings>Docstrings</a>
<li><a href=your-first-python-program.html#functionannotations>Function annotations</a>
<li><a href=your-first-python-program.html#styleconventions>Style conventions</a>
</ol>
<li><a href=your-first-python-program.html#everythingisanobject>Everything is an object</a>
<ol>
<li><a href=your-first-python-program.html#importsearchpath>The <code>import</code> search path</a>
<li><a href=your-first-python-program.html#whatsanobject>What's an object?</a>
</ol>
<li><a href=your-first-python-program.html#indentingcode>Indenting code</a>
<li><a href=your-first-python-program.html#runningscripts>Running scripts</a>
<li><a href=your-first-python-program.html#furtherreading>Further reading</a>
</ol>
<li id=native-python-datatypes><a href=native-datatypes.html>Native Python datatypes</a>
<ol>
<li><a href=native-datatypes.html#divingin>Diving in</a>
<li><a href=native-datatypes.html#booleans>Booleans</a>
<li><a href=native-datatypes.html#numbers>Numbers</a>
<li><a href=native-datatypes.html#lists>Lists</a>
<!--
<li><a href=native-datatypes.html#sets>Sets</a>
-->
<li><a href=native-datatypes.html#dictionaries>Dictionaries</a>
<li><a href=native-datatypes.html#none><code>None</code></a>
<li><a href=native-datatypes.html#furtherreading>Further reading</a>
</ol>
<li>Strings
<ol>
<li>There ain't no such thing as plain text
<ol>
<li>A brief history of character encoding
<li>What's a character?
<li>How strings are stored in memory
<li>Converting between different character encodings
</ol>
<li>Formatting strings
<li>What's my string?
<li>Lists and strings
<li>Historical note on the string module
<li>Byte streams
<li>Summary
</ol>
<li id=regular-expressions><a href=regular-expressions.html>Regular expressions</a>
<ol>
<li><a href=regular-expressions.html#divingin>Diving in</a>
<li><a href=regular-expressions.html#streetaddresses>Case study: street addresses</a>
<li><a href=regular-expressions.html#romannumerals>Case study: Roman numerals</a>
<ol>
<li><a href=regular-expressions.html#thousands>Checking for thousands</a>
<li><a href=regular-expressions.html#hundreds>Checking for hundreds</a>
</ol>
<li><a href=regular-expressions.html#nmsyntax>Using the <code>{n,m}</code> Syntax</a>
<ol>
<li><a href=regular-expressions.html#tensandones>Checking for tens and ones</a>
</ol>
<li><a href=regular-expressions.html#verbosere>Verbose regular expressions</a>
<li><a href=regular-expressions.html#phonenumbers>Case study: parsing phone numbers</a>
<li><a href=regular-expressions.html#summary>Summary</a>
</ol>
<li>The power of introspection
<ol>
<li>Diving in
<li>Using optional and named arguments
<ol>
<li>Keyword-only arguments
</ol>
<li>Using type, str, dir, and other built-in functions
<ol>
<li>The type function
<li>The str function
<li>Built-in functions
</ol>
<li>Getting object references with getattr
<ol>
<li>getattr with modules
<li>getattr as a dispatcher
</ol>
<li>Filtering lists
<li>Using lambda functions
<li>Putting it all together
<li>Summary
</ol>
<li>Objects and object-orientation
<ol>
<li>...major changes afoot...
<li>...stuff about decorators...
<li>...stuff about importing modules...
<ol>
<li>...mention why from module import * is only allowed at module level
</ol>
</ol>
<li id=unit-testing><a href=unit-testing.html>Unit testing</a>
<ol>
<li><a href=unit-testing.html#divingin>(Not) diving in</a>
<li><a href=unit-testing.html#romantest1>A single question</a>
<li><a href=unit-testing.html#romantest2>&#8220;Halt and catch fire&#8221;</a>
<li><a href=unit-testing.html#romantest3>More halting, more fire</a>
<li>...
</ol>
<li>Test-first programming
<ol>
<li>...
</ol>
<li>Refactoring your code
<ol>
<li>Handling bugs
<li>Handling changing requirements
<li>The art of refactoring
<li>Postscript
<li>Summary
</ol>
<li>Files
<ol>
<li>File objects
<li>Reading files
<li>Close your files... or don't
<li>Handling errors (exceptions)
<li>Writing to files
</ol>
<li>HTML processing
<ol>
<li>Diving in
<li>html5lib
<ol>
<li>Installing html5lib
<li>Using html5lib
</ol>
<li>Extracting data from HTML documents
<li>Building HTML documents
<li>Putting it all together
<li>Summary
</ol>
<li>XML Processing
<ol>
<li>...major changes afoot...
</ol>
<li>HTTP web services
<ol>
<li>Diving in
<li>How not to fetch data over HTTP
<li>Features of HTTP
<ol>
<li>User-Agent
<li>Redirects
<li>Last-Modified/If-Modified-Since
<li>ETag-If-None-Match
<li>Compression
</ol>
<li>Differences from Python 2
<li>httplib2 (note: needs port)
<ol>
<li>Installing httplib2
<li>Why httplib2 is better than http.client
</ol>
<li>Debugging HTTP web services
<li>Setting the User-Agent
<li>Handling Last-Modified and ETag
<li>Handling redirects
<li>Handling compressed data
<li>Putting it all together
<li>Summary
</ol>
<li>Dynamic functions
<ol>
<li>Diving in
<li>plural.py, stage 1
<li>plural.py, stage 2
<li>plural.py, stage 3
<li>plural.py, stage 4
<li>plural.py, stage 5
<li>plural.py, stage 6
<li>Summary
</ol>
<li>Metaclasses
<ol>
<li>...once I figure out WTF metaclasses are...
</ol>
<li>Performance tuning
<ol>
<li>Diving in
<li>Using the timeit module
<li>Optimizing regular expressions
<li>Optimizing dictionary lookups
<li>Optimizing list operations
<li>Optimizing string manipulation
<li>Summary
</ol>
<li>Packaging Python libraries
<!-- http://pypi.python.org/pypi -->
<ol>
<li>A brief history of packaging (and why it's harder than you think)
<li>setuptools
<li>distutils
<li>Eggs
<li>pip
<li>Platform-specific packaging
<ol>
<li>Packaging by Linux distributions
<li>Py2exe
</ol>
</ol>
<li>Creating graphics with the Python Imaging Library
<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-<abbr>FAQ</abbr></a>
<ol>
<li><a href=case-study-porting-chardet-to-python-3.html#faq.what>What is character encoding auto-detection?</a>
<li><a href=case-study-porting-chardet-to-python-3.html#faq.impossible>Isn't that impossible?</a>
<li><a href=case-study-porting-chardet-to-python-3.html#faq.who>Who wrote this detection algorithm?</a>
<li><a href=case-study-porting-chardet-to-python-3.html#faq.yippie>Yippie! Screw the standards, I'll just auto-detect everything!</a>
<li><a href=case-study-porting-chardet-to-python-3.html#faq.why>Why bother with auto-detection if it's slow, inaccurate, and non-standard?</a>
</ol>
<li><a href=case-study-porting-chardet-to-python-3.html#divingin2>Diving in</a>
<ol>
<li><a href=case-study-porting-chardet-to-python-3.html#how.bom><code>UTF-n</code> with a <abbr>BOM</abbr></a>
<li><a href=case-study-porting-chardet-to-python-3.html#how.esc>Escaped encodings</a>
<li><a href=case-study-porting-chardet-to-python-3.html#how.mb>Multi-byte encodings</a>
<li><a href=case-study-porting-chardet-to-python-3.html#how.sb>Single-byte encodings</a>
<li><a href=case-study-porting-chardet-to-python-3.html#how.windows1252><code>windows-1252</code></a>
</ol>
<li><a href=case-study-porting-chardet-to-python-3.html#running2to3>Running <code>2to3</code></a>
<li><a href=case-study-porting-chardet-to-python-3.html#manual>Fixing what <code>2to3</code> can't</a>
<ol>
<li><a href=case-study-porting-chardet-to-python-3.html#falseisinvalidsyntax><code>False</code> is invalid syntax</a>
<li><a href=case-study-porting-chardet-to-python-3.html#nomodulenamedconstants>No module named <code>constants</code></a>
<li><a href=case-study-porting-chardet-to-python-3.html#namefileisnotdefined>Name '<var>file</var>' is not defined</a>
<li><a href=case-study-porting-chardet-to-python-3.html#cantuseastringpattern>Can't use a string pattern on a bytes-like object</a>
<li><a href=case-study-porting-chardet-to-python-3.html#cantconvertbytesobject>Can't convert '<code>bytes</code>' object to <code>str</code> implicitly</a>
</ol>
</ol>
</ol>
<ul>
<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>
<li><a href=porting-code-to-python-3-with-2to3.html#print><code>print</code> statement</a>
<li><a href=porting-code-to-python-3-with-2to3.html#unicodeliteral>Unicode string literals</a>
<li><a href=porting-code-to-python-3-with-2to3.html#unicode><code>unicode()</code> global function</a>
<li><a href=porting-code-to-python-3-with-2to3.html#long><code>long</code> data type</a>
<li><a href=porting-code-to-python-3-with-2to3.html#ne>&lt;> comparison</a>
<li><a href=porting-code-to-python-3-with-2to3.html#has_key><code>has_key()</code> dictionary method</a>
<li><a href=porting-code-to-python-3-with-2to3.html#dict>Dictionary methods that return lists</a>
<li><a href=porting-code-to-python-3-with-2to3.html#imports>Modules that have been renamed or reorganized</a>
<ol>
<li><a href=porting-code-to-python-3-with-2to3.html#http><code>http</code></a>
<li><a href=porting-code-to-python-3-with-2to3.html#urllib><code>urllib</code></a>
<li><a href=porting-code-to-python-3-with-2to3.html#dbm><code>dbm</code></a>
<li><a href=porting-code-to-python-3-with-2to3.html#xmlrpc><code>xmlrpc</code></a>
<li><a href=porting-code-to-python-3-with-2to3.html#othermodules>Other modules</a>
</ol>
<li><a href=porting-code-to-python-3-with-2to3.html#import>Relative imports within a package</a>
<li><a href=porting-code-to-python-3-with-2to3.html#next><code>next()</code> iterator method</a>
<li><a href=porting-code-to-python-3-with-2to3.html#filter><code>filter()</code> global function</a>
<li><a href=porting-code-to-python-3-with-2to3.html#map><code>map()</code> global function</a>
<li><a href=porting-code-to-python-3-with-2to3.html#reduce><code>reduce()</code> global function</a> (3.1+)
<li><a href=porting-code-to-python-3-with-2to3.html#apply><code>apply()</code> global function</a>
<li><a href=porting-code-to-python-3-with-2to3.html#intern><code>intern()</code> global function</a>
<li><a href=porting-code-to-python-3-with-2to3.html#exec><code>exec</code> statement</a>
<li><a href=porting-code-to-python-3-with-2to3.html#execfile><code>execfile</code> statement</a> (3.1+)
<li><a href=porting-code-to-python-3-with-2to3.html#repr><code>repr</code> literals (backticks)</a>
<li><a href=porting-code-to-python-3-with-2to3.html#except><code>try...except</code> statement</a>
<li><a href=porting-code-to-python-3-with-2to3.html#raise><code>raise</code> statement</a>
<li><a href=porting-code-to-python-3-with-2to3.html#throw><code>throw</code> method on generators</a>
<li><a href=porting-code-to-python-3-with-2to3.html#xrange><code>xrange()</code> global function</a>
<li><a href=porting-code-to-python-3-with-2to3.html#raw_input><code>raw_input()</code> and <code>input()</code> global functions</a>
<li><a href=porting-code-to-python-3-with-2to3.html#funcattrs><code>func_*</code> function attributes</a>
<li><a href=porting-code-to-python-3-with-2to3.html#xreadlines><code>xreadlines()</code> I/O method</a>
<li><a href=porting-code-to-python-3-with-2to3.html#tuple_params><code>lambda</code> functions with multiple parameters</a>
<li><a href=porting-code-to-python-3-with-2to3.html#methodattrs>Special method attributes</a>
<li><a href=porting-code-to-python-3-with-2to3.html#nonzero><code>__nonzero__</code> special class attribute</a>
<li><a href=porting-code-to-python-3-with-2to3.html#numliterals>Octal literals</a>
<li><a href=porting-code-to-python-3-with-2to3.html#renames><code>sys.maxint</code></a>
<li><a href=porting-code-to-python-3-with-2to3.html#callable><code>callable()</code> global function</a>
<li><a href=porting-code-to-python-3-with-2to3.html#zip><code>zip()</code> global function</a>
<li><a href=porting-code-to-python-3-with-2to3.html#standarderror><code>StandardError()</code> exception</a>
<li><a href=porting-code-to-python-3-with-2to3.html#types><code>types</code> module constants</a>
<li><a href=porting-code-to-python-3-with-2to3.html#isinstance><code>isinstance()</code> global function</a> (3.1+)
<li><a href=porting-code-to-python-3-with-2to3.html#basestring><code>basestring</code> datatype</a>
<li><a href=porting-code-to-python-3-with-2to3.html#itertools><code>itertools</code> module</a>
<li><a href=porting-code-to-python-3-with-2to3.html#sys_exc><code>sys.exc_type</code>, <code>sys.exc_value</code>, <code>sys.exc_traceback</code></a>
<li><a href=porting-code-to-python-3-with-2to3.html#paren>List comprehensions over tuples</a>
<li><a href=porting-code-to-python-3-with-2to3.html#getcwdu><code>os.getcwdu()</code> function</a>
<li><a href=porting-code-to-python-3-with-2to3.html#metaclass>Metaclasses</a>
<li><a href=porting-code-to-python-3-with-2to3.html#nitpick>Matters of style</a>
<ol>
<li><a href=porting-code-to-python-3-with-2to3.html#set_literal><code>set()</code> literals</a>
<li><a href=porting-code-to-python-3-with-2to3.html#buffer><code>buffer()</code> global function</a>
<li><a href=porting-code-to-python-3-with-2to3.html#wscomma>Whitespace around commas</a>
<li><a href=porting-code-to-python-3-with-2to3.html#idioms>Common idioms</a>
</ol>
</ol>
</ul>
<p>Orphans (not sure where these belong yet):
<ul>
<li>Tuples
<li>Iterators
<li>Generators
<li>List comprehensions
<li>Set comprehensions
<li>Dictionary comprehensions
<li>Views (several dictionary methods return them, they're dynamic, update when the dictionary changes, etc.)
</ul>
<p class=c>&copy; 2001&ndash;4, 2009 <span>&#x2133;</span>ark Pilgrim &#8226; <a href=about.html>open standards &#8226; open content &#8226; open source</a>