mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
402 lines
21 KiB
HTML
402 lines
21 KiB
HTML
<!DOCTYPE html>
|
|
<head>
|
|
<meta charset=utf-8>
|
|
<title>Table of contents - Dive Into Python 3</title>
|
|
<link rel=stylesheet 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>
|
|
<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 class=u>‣</span> Dive Into Python 3 <span class=u>‣</span>
|
|
<h1>Table of Contents</h1>
|
|
<ol start=-1>
|
|
<li id=whats-new><a href=whats-new.html>What’s New In “Dive Into Python 3”</a>
|
|
<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>
|
|
</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>
|
|
<ol>
|
|
<li><a href=native-datatypes.html#number-coercion>Coercing integers to floats and vice-versa</a>
|
|
<li><a href=native-datatypes.html#common-numerical-operations>Common numerical operations</a>
|
|
<li><a href=native-datatypes.html#fractions>Fractions</a>
|
|
<li><a href=native-datatypes.html#trig>Trigonometry</a>
|
|
<li><a href=native-datatypes.html#numbers-in-a-boolean-context>Numbers in a boolean context</a>
|
|
</ol>
|
|
<li><a href=native-datatypes.html#lists>Lists</a>
|
|
<ol>
|
|
<li><a href=native-datatypes.html#creatinglists>Creating a list</a>
|
|
<li><a href=native-datatypes.html#slicinglists>Slicing a list</a>
|
|
<li><a href=native-datatypes.html#extendinglists>Adding items to a list</a>
|
|
<li><a href=native-datatypes.html#searchinglists>Searching for values in a list</a>
|
|
<li><a href=native-datatypes.html#lists-in-a-boolean-context>Lists in a boolean context</a>
|
|
</ol>
|
|
<!--
|
|
<li><a href=native-datatypes.html#sets>Sets</a>
|
|
<ol>
|
|
<li>Creating a new set
|
|
<li>Modifying a set
|
|
<li>Deleting items from a set
|
|
<li>Common operations on sets (union, intersection, and difference)
|
|
<li>Frozen sets
|
|
</ol>
|
|
-->
|
|
<li><a href=native-datatypes.html#dictionaries>Dictionaries</a>
|
|
<ol>
|
|
<li><a href=native-datatypes.html#creating-dictionaries>Creating a dictionary</a>
|
|
<li><a href=native-datatypes.html#modifying-dictionaries>Modifying a dictionary</a>
|
|
<li><a href=native-datatypes.html#mixed-value-dictionaries>Mixed-value dictionaries</a>
|
|
<li><a href=native-datatypes.html#dictionaries-in-a-boolean-context>Dictionaries in a boolean context</a>
|
|
</ol>
|
|
<li><a href=native-datatypes.html#none><code>None</code></a>
|
|
<ol>
|
|
<li><a href=native-datatypes.html#none-in-a-boolean-context><code>None</code> in a boolean context</a>
|
|
</ol>
|
|
<li><a href=native-datatypes.html#furtherreading>Further reading</a>
|
|
</ol>
|
|
<li id=strings><a href=strings.html>Strings</a>
|
|
<ol>
|
|
<li><a href=strings.html#divingin>Diving in</a>
|
|
<li><a href=strings.html#one-ring-to-rule-them-all>Unicode</a>
|
|
<ol>
|
|
<li>How strings are stored in memory
|
|
<li>Converting between different character encodings
|
|
<li><a href=strings.html#py-encoding>Specifying character encoding in <code>.py</code> files</a>
|
|
</ol>
|
|
<li>Strings in Python 3
|
|
<li>Common string operations
|
|
<li>Formatting strings
|
|
<li><a href=strings.html#string-module>The <code>string</code> module</a>
|
|
<li><a href=strings.html#byte-arrays>Strings vs. bytes</a>
|
|
<li><a href=strings.html#furtherreading>Further reading</a>
|
|
</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 id=generators><a href=generators.html>Generators</a>
|
|
<ol>
|
|
<li><a href=generators.html#divingin>Diving in</a>
|
|
<li><a href=generators.html#i-know>I know, let’s use regular expressions!</a>
|
|
<li><a href=generators.html#a-list-of-functions>A list of functions</a>
|
|
<li><a href=generators.html#a-list-of-patterns>A list of patterns</a>
|
|
<li><a href=generators.html#a-file-of-patterns>A file of patterns</a>
|
|
<li><a href=generators.html#generators>Generators</a>
|
|
<ol>
|
|
<li><a href=generators.html#a-fibonacci-generator>A Fibonacci generator</a>
|
|
<li><a href=generators.html#a-plural-rule-generator>A plural rule generator</a>
|
|
</ol>
|
|
</ol>
|
|
<li id=iterators><a href=iterators.html>Iterators</a>
|
|
<ol>
|
|
<li><a href=iterators.html#divingin>Diving In</a>
|
|
<li><a href=iterators.html#defining-classes>Defining Classes</a>
|
|
<li><a href=iterators.html#instantiating-classes>Instantiating Classes</a>
|
|
<li><a href=iterators.html#instance-variables>Instance Variables</a>
|
|
<li><a href=iterators.html#a-fibonacci-iterator>A Fibonacci iterator</a>
|
|
<li><a href=iterators.html#a-plural-rule-iterator>A Plural Rule Iterator</a>
|
|
<li><a href=iterators.html#furtherreading>Further Reading</a>
|
|
</ol>
|
|
<li id=advanced-iterators><a href=advanced-iterators.html>Advanced Iterators</a>
|
|
<ol>
|
|
<li><a href=advanced-iterators.html#divingin>Diving In</a>
|
|
<li><a href=advanced-iterators.html#re-findall>Finding all occurrences of a pattern</a>
|
|
<li><a href=advanced-iterators.html#unique-items>Finding the unique items in a sequence</a>
|
|
<li><a href=advanced-iterators.html#assert>Making assertions</a>
|
|
<li><a href=advanced-iterators.html#generator-expressions>Generator expressions</a>
|
|
<li><a href=advanced-iterators.html#permutations>Calculating Permutations… The Lazy Way!</a>
|
|
<li><a href=advanced-iterators.html#more-itertools>Other Fun Stuff in the <code>itertools</code> Module</a>
|
|
<li><a href=advanced-iterators.html#string-translate>A New Kind Of String Manipulation</a>
|
|
<li><a href=advanced-iterators.html#eval>Evaluating Arbitrary Strings As Python Expressions</a>
|
|
<li><a href=advanced-iterators.html#alphametics-finale>Putting It All Together</a>
|
|
<li><a href=advanced-iterators.html#furtherreading>Further Reading</a>
|
|
</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>“Halt and catch fire”</a>
|
|
<li><a href=unit-testing.html#romantest3>More halting, more fire</a>
|
|
<li>...
|
|
</ol>
|
|
<li>Test-first programming
|
|
<ol>
|
|
<li>...
|
|
</ol>
|
|
<li><a href=refactoring.html>Refactoring your code</a>
|
|
<ol>
|
|
<li><a href=refactoring.html#divingin>Diving in</a>
|
|
<li><a href=refactoring.html#changing-requirements>Handling changing requirements</a>
|
|
<li><a href=refactoring.html#refactoring>Refactoring</a>
|
|
<li><a href=refactoring.html#summary>Summary</a>
|
|
</ol>
|
|
<li id=advanced-classes><a href=advanced-classes.html>Advanced Classes</a>
|
|
<ol>
|
|
<li><a href=advanced-classes.html#divingin>Diving in</a>
|
|
</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 id=xml>XML
|
|
<ol>
|
|
<li><a href=xml.html#divingin>Diving In</a>
|
|
<li><a href=xml.html#xml-intro>A 5-Minute Crash Course in XML</a>
|
|
<li><a href=xml.html#xml-structure>The Structure Of An Atom Feed</a>
|
|
<li><a href=xml.html#xml-parse>Parsing XML</a>
|
|
<ol>
|
|
<li><a href=xml.html#xml-elements>Elements Are Lists</a>
|
|
<li><a href=xml.html#xml-attributes>Attributes Are Dictonaries</a>
|
|
</ol>
|
|
<li><a href=xml.html#xml-find>Searching For Nodes Within An XML Document</a>
|
|
<li><a href=xml.html#xml-lxml>Going Further With lxml</a>
|
|
<ol>
|
|
<li><a href=xml.html#xml-custom-parser>Customizing Your XML Parser</a>
|
|
<li><a href=xml.html#xml-incremental>Incremental Parsing</a>
|
|
</ol>
|
|
<li><a href=xml.html#xml-generate>Generating XML</a>
|
|
<li><a href=xml.html#furtherreading>Further Reading</a>
|
|
</ol>
|
|
<li>HTML
|
|
<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 id=http-web-services>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>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 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>
|
|
<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 BOM</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>
|
|
<li id=where-to-go-from-here><a href=where-to-go-from-here.html>Where to go from here</a>
|
|
<ol>
|
|
<li><a href=where-to-go-from-here.html#things-to-read>Things to read</a>
|
|
<li><a href=where-to-go-from-here.html#code>Where to look for Python 3-compatible code</a>
|
|
</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><> 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 that take a tuple instead of 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 method</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>
|
|
<li id=special-method-names><a href=special-method-names.html>Appendix B. Special Method Names</a>
|
|
<ol>
|
|
<li><a href=special-method-names.html#divingin>Diving in</a>
|
|
<li><a href=special-method-names.html#basics>Basics</a>
|
|
<li><a href=special-method-names.html#acts-like-iterator>Classes That Act Like Iterators</a>
|
|
<li><a href=special-method-names.html#computed-attributes>Computed Attributes</a>
|
|
<li><a href=special-method-names.html#acts-like-function>Classes That Act Like Functions</a>
|
|
<li><a href=special-method-names.html#acts-like-list>Classes That Act Like Sequences</a>
|
|
<li><a href=special-method-names.html#acts-like-dict>Classes That Act Like Dictionaries</a>
|
|
<li><a href=special-method-names.html#acts-like-number>Classes That Act Like Numbers</a>
|
|
<li><a href=special-method-names.html#rich-comparisons>Classes That Can Be Compared</a>
|
|
<li><a href=special-method-names.html#pickle>Classes That Can Be Serialized</a>
|
|
<li><a href=special-method-names.html#context-managers>Classes That Can Be Used in a <code>with</code> Block</a>
|
|
<li><a href=special-method-names.html#esoterica>Really Esoteric Stuff</a>
|
|
</ol>
|
|
</ul>
|
|
<p>Orphans (not sure where these belong yet):
|
|
<ul>
|
|
<li>Tuples
|
|
<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.)
|
|
<li>Function annotations
|
|
<li>PEP 8 style conventions
|
|
<li>Importing modules
|
|
<ol>
|
|
<li>...mention why from module import * is only allowed at module level
|
|
</ol>
|
|
</ul>
|
|
<p class=c>© 2001–9 <a href=about.html>Mark Pilgrim</a>
|