mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
371 lines
16 KiB
HTML
371 lines
16 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Table of contents - Dive Into Python 3</title>
|
|
<link rel="stylesheet" type="text/css" href="dip3.css">
|
|
<link rel="shortcut icon" href="data:image/ico,">
|
|
<link rel="alternate" type="application/atom+xml" href="http://hg.diveintopython3.org/atom-log">
|
|
<style type="text/css">
|
|
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>
|
|
<body>
|
|
<form action="http://www.google.com/cse" id="search"><div><input type="hidden" name="cx" value="014021643941856155761:l5eihuescdw"><input type="hidden" name="ie" value="UTF-8"><input name="q" size="31"> <input type="submit" name="sa" value="Search"></div></form>
|
|
<p class="nav">You are here: <a href="/">Home</a> <span>‣</span> Dive Into Python 3 <span>‣</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><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>
|
|
</ol>
|
|
<li><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>
|
|
<!--
|
|
<ol>
|
|
<li><a href="native-datatypes.html#integers">Integers</a>
|
|
<li><a href="native-datatypes.html#floats">Floating point numbers</a>
|
|
<li><a href="native-datatypes.html#fractions">Fractions</a>
|
|
<li><a href="native-datatypes.html#complexnumbers">Complex numbers</a>
|
|
<li><a href="native-datatypes.html#numberoperations">Common operations on numbers</a>
|
|
<li><a href="native-datatypes.html#math">The <code>math</code> module</a>
|
|
</ol>
|
|
-->
|
|
<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
|
|
<li><a href="native-datatypes.html#none"><code>None</code></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>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>Exceptions
|
|
<ol>
|
|
<li>...
|
|
</ol>
|
|
<li>Files
|
|
<ol>
|
|
<li>File objects
|
|
<li>Reading files
|
|
<li>Close your files... or don't
|
|
<li>Handling I/O errors
|
|
<li>Writing to files
|
|
</ol>
|
|
<li>Regular expressions
|
|
<ol>
|
|
<li>Diving in
|
|
<li>Case study: street addresses
|
|
<li>Case study: Roman numerals
|
|
<ol>
|
|
<li>Checking for thousands
|
|
<li>Checking for hundreds
|
|
</ol>
|
|
<li>Using the {n,m} syntax
|
|
<ol>
|
|
<li>Checking for tens and ones
|
|
</ol>
|
|
<li>Verbose regular expressions
|
|
<li>Case study: parsing phone numbers
|
|
<li>Summary
|
|
</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>Unit testing
|
|
<ol>
|
|
<li>Introduction to Roman numerals
|
|
<li>Diving in
|
|
<li>Introducing romantest.py
|
|
<li>Testing for success
|
|
<li>Testing for failure
|
|
<li>Testing for sanity
|
|
</ol>
|
|
<li>Test-first programming
|
|
<ol>
|
|
<li>roman.py, stage 1
|
|
<li>roman.py, stage 2
|
|
<li>roman.py, stage 3
|
|
<li>roman.py, stage 4
|
|
<li>roman.py, stage 5
|
|
</ol>
|
|
<li>Refactoring your code
|
|
<ol>
|
|
<li>Handling bugs
|
|
<li>Handling changing requirements
|
|
<li>The art of refactoring
|
|
<li>Postscript
|
|
<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><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 class="filename">chardet</code>: a mini-FAQ</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 title="Byte Order Mark">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 class="filename">2to3</code></a>
|
|
<li><a href="case-study-porting-chardet-to-python-3.html#manual">Fixing what <code class="filename">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 class="filename">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>
|
|
<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>
|
|
</ol>
|
|
<ul>
|
|
<li><a href="porting-code-to-python-3-with-2to3.html">Appendix A. Porting code to Python 3 with <code class="filename">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"><> 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">© 2001-4, 2009 <span>ℳ</span>ark Pilgrim, <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">CC-BY-3.0</a>
|
|
</body>
|
|
</html>
|