updated TOC

This commit is contained in:
Mark Pilgrim
2009-01-30 00:28:56 -05:00
parent 891e357a2a
commit 504e9cbdb1
2 changed files with 73 additions and 480 deletions
+5 -5
View File
@@ -41,9 +41,9 @@ body{counter-reset:h1 19}
<h2 id="faq">Introducing <code class="filename">chardet</code>: a mini-FAQ</h2>
<p class="fancy">When you think of text, you probably think of characters and symbols I see on my computer screen. But computers don't deal in characters and symbols; they deal in bits and bytes. Every piece of text you've ever seen on a computer screen is actually stored in a particular <em>character encoding</em>. There are many different character encodings, some optimized for particular languages like Russian or Chinese or English, and others that can be used for multiple languages. Very roughly speaking, the character encoding provides a mapping between the stuff you see on your screen and the stuff your computer actually stores in memory and on disk.
<p class="fancy">When you think of "text", you probably think of "characters and symbols I see on my computer screen". But computers don't deal in characters and symbols; they deal in bits and bytes. Every piece of text you've ever seen on a computer screen is actually stored in a particular <em>character encoding</em>. There are many different character encodings, some optimized for particular languages like Russian or Chinese or English, and others that can be used for multiple languages. Very roughly speaking, the character encoding provides a mapping between the stuff you see on your screen and the stuff your computer actually stores in memory and on disk.
<p>In reality, it's more complicated than that. Many characters are common to multiple encodings, but each encoding may use a different sequence of bytes to actually store those characters in memory or on disk. So you can think of the character encoding as a kind of decryption key for the text. Whenever someone gives you a sequence of bytes and claims it's text, you need to know what character encoding they used so you can decode the bytes into characters and display them (or process them, or whatever).
<p>In reality, it's more complicated than that. Many characters are common to multiple encodings, but each encoding may use a different sequence of bytes to actually store those characters in memory or on disk. So you can think of the character encoding as a kind of decryption key for the text. Whenever someone gives you a sequence of bytes and claims it's "text", you need to know what character encoding they used so you can decode the bytes into characters and display them (or process them, or whatever).
<h3 id="faq.what">What is character encoding auto-detection?</h3>
@@ -51,7 +51,7 @@ body{counter-reset:h1 19}
<h3 id="faq.impossible">Isn't that impossible?</h3>
<p>In general, yes. However, some encodings are optimized for specific languages, and languages are not random. Some character sequences pop up all the time, while other sequences make no sense. A person fluent in English who opens a newspaper and finds txzqJv 2!dasd0a QqdKjvz will instantly recognize that that isn't English (even though it is composed entirely of English letters). By studying lots of typical text, a computer algorithm can simulate this kind of fluency and make an educated guess about a text's language.
<p>In general, yes. However, some encodings are optimized for specific languages, and languages are not random. Some character sequences pop up all the time, while other sequences make no sense. A person fluent in English who opens a newspaper and finds "txzqJv 2!dasd0a QqdKjvz" will instantly recognize that that isn't English (even though it is composed entirely of English letters). By studying lots of "typical" text, a computer algorithm can simulate this kind of fluency and make an educated guess about a text's language.
<p>In other words, encoding detection is really language detection, combined with knowledge of which languages tend to use which character encodings.
<h3 id="faq.who">Who wrote this detection algorithm?</h3>
@@ -108,7 +108,7 @@ body{counter-reset:h1 19}
<h3 id="how.mb">Multi-byte encodings</h3>
<p>Assuming no <abbr title="Byte Order Mark">BOM</abbr>, <code>UniversalDetector</code> checks whether the text contains any high-bit characters. If so, it creates a series of <span class="quote">probers</span> for detecting multi-byte encodings, single-byte encodings, and as a last resort, <code>windows-1252</code>.
<p>Assuming no <abbr title="Byte Order Mark">BOM</abbr>, <code>UniversalDetector</code> checks whether the text contains any high-bit characters. If so, it creates a series of "<span class="quote">probers</span>" for detecting multi-byte encodings, single-byte encodings, and as a last resort, <code>windows-1252</code>.
<p>The multi-byte encoding prober, <code>MBCSGroupProber</code> (defined in <code class="filename">mbcsgroupprober.py</code>), is really just a shell that manages a group of other probers, one for each multi-byte encoding: <code>Big5</code>, <code>GB2312</code>, <code>EUC-TW</code>, <code>EUC-KR</code>, <code>EUC-JP</code>, <code>SHIFT_JIS</code>, and <code>UTF-8</code>. <code>MBCSGroupProber</code> feeds the text to each of these encoding-specific probers and checks the results. If a prober reports that it has found an illegal byte sequence, it is dropped from further processing (so that, for instance, any subsequent calls to <code>UniversalDetector</code>.<code>feed()</code> will skip that prober). If a prober reports that it is reasonably confident that it has detected the encoding, <code>MBCSGroupProber</code> reports this positive result to <code>UniversalDetector</code>, which reports the result to the caller.
@@ -124,7 +124,7 @@ body{counter-reset:h1 19}
<p><code>SBCSGroupProber</code> feeds the text to each of these encoding+language-specific probers and checks the results. These probers are all implemented as a single class, <code>SingleByteCharSetProber</code> (defined in <code class="filename">sbcharsetprober.py</code>), which takes a language model as an argument. The language model defines how frequently different 2-character sequences appear in typical text. <code>SingleByteCharSetProber</code> processes the text and tallies the most frequently used 2-character sequences. Once enough text has been processed, it calculates a confidence level based on the number of frequently-used sequences, the total number of characters, and a language-specific distribution ratio.
<p>Hebrew is handled as a special case. If the text appears to be Hebrew based on 2-character distribution analysis, <code>HebrewProber</code> (defined in <code class="filename">hebrewprober.py</code>) tries to distinguish between Visual Hebrew (where the source text actually stored <span class="quote">backwards</span> line-by-line, and then displayed verbatim so it can be read from right to left) and Logical Hebrew (where the source text is stored in reading order and then rendered right-to-left by the client). Because certain characters are encoded differently based on whether they appear in the middle of or at the end of a word, we can make a reasonable guess about direction of the source text, and return the appropriate encoding (<code>windows-1255</code> for Logical Hebrew, or <code>ISO-8859-8</code> for Visual Hebrew).
<p>Hebrew is handled as a special case. If the text appears to be Hebrew based on 2-character distribution analysis, <code>HebrewProber</code> (defined in <code class="filename">hebrewprober.py</code>) tries to distinguish between Visual Hebrew (where the source text actually stored "<span class="quote">backwards</span>" line-by-line, and then displayed verbatim so it can be read from right to left) and Logical Hebrew (where the source text is stored in reading order and then rendered right-to-left by the client). Because certain characters are encoded differently based on whether they appear in the middle of or at the end of a word, we can make a reasonable guess about direction of the source text, and return the appropriate encoding (<code>windows-1255</code> for Logical Hebrew, or <code>ISO-8859-8</code> for Visual Hebrew).
<h3 id="how.windows1252"><code>windows-1252</code></h3>
+68 -475
View File
@@ -12,49 +12,18 @@
<p><cite>Dive Into Python 3</cite> will cover Python 3 and its differences from Python 2. Compared to the original <cite><a href="http://diveintopython.org/">Dive Into Python</a></cite>, it will be about 50% revised and 50% new material. I will publish drafts online as I go. The final book will be published on paper by Apress. The book will remain online under the <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">CC-BY-3.0</a> license.</p>
<p>Below is the draft table of contents. It is <b>not finalized</b>. Only a few chapters have been written so far. The rest is just stubs and random notes to myself.</p>
<p>Yes, that is <code>PapayaWhip</code>. All hail <code>PapayaWhip</code>.</p>
<section>
<h1>Installing Python</h1>
<section>
<h2>Python on Windows</h2>
</section>
<section>
<h2>Python on Mac OS X</h2>
</section>
<section>
<h2>Python on Linux</h2>
</section>
<section>
<h2>Python from source</h2>
</section>
<section>
<h2>The interactive shell</h2>
</section>
<section>
<h2>Summary</h2>
</section>
</section>
<section>
<h1>Your first Python program</h1>
<section>
<h2>Diving in</h2>
</section>
<section>
<h2>Declaring functions</h2>
<h3>How Python's datatypes compare to other programming languages</h3>
</section>
<section>
<h2>Writing readable code</h2>
<h3>Why bother?</h3>
<h3>Docstrings</h3>
@@ -63,33 +32,16 @@
<h3>Style conventions</h3>
<!-- http://www.python.org/dev/peps/pep-0008/ -->
<h3>...</h3>
</section>
<section>
<h2>Everything is an object</h2>
<h3>The import search path</h3>
<h3>What's an object?</h3>
</section>
<section>
<h2>Indenting code</h2>
</section>
<section>
<h2>Testing modules</h2>
</section>
<section>
<h2>Summary</h2>
</section>
</section>
<section>
<h1>Native Python datatypes</h1>
<!-- "Lists and tuples and sets, oh my!" -->
<section>
<h2>Lists</h2>
<h3>Differences from Python 2</h3>
<h3>Creating new a list</h3>
@@ -99,9 +51,6 @@
<h3>List operators</h3>
<h3>Looping through a list (list comprehensions)</h3>
<h3>Tuples</h3>
</section>
<section>
<h2>Dictionaries</h2>
<h3>Differences from Python 2</h3>
<h3>Creating a new dictionary</h3>
@@ -109,9 +58,6 @@
<h3>Deleting items from a dictionary</h3>
<h3>Looping through a dictionary (dictionary comprehensions)</h3>
<h3>Dictionary views</h3>
</section>
<section>
<h2>Sets</h2>
<h3>Differences from Python 2</h3>
<h3>Creating a new set</h3>
@@ -119,9 +65,6 @@
<h3>Deleting elements from a set</h3>
<h3>Common set operations: union, intersection, and difference</h3>
<h3>Frozen sets</h3>
</section>
<section>
<h2>Numbers</h2>
<h3>Differences from Python 2</h3>
<h3>Integers</h3>
@@ -129,615 +72,265 @@
<h3>Floating point numbers</h3>
<h3>Complex numbers</h3>
<h3>Common numerical operations</h3>
</section>
</section>
<section>
<h1></h1>
<!-- "I read part of it all the way through." -->
<section>
<h2>Iterators</h2>
</section>
<section>
<h2>Generators</h2>
</section>
<section>
<h2>Views</h2>
</section>
<section>
<h2>...</h2>
</section>
</section>
</section>
<section>
<h1>Strings</h1>
<section>
<h2>There ain't no such thing as "plain text"</h2>
<h3>A brief history of character encoding</h3>
<h3>What's a character?</h3>
<h3>How strings are stored in memory</h3>
<h3>Converting between different character encodings</h3>
</section>
<section>
<h2>Differences from Python 2</h2>
</section>
<section>
<h2>Formatting strings</h2>
</section>
<section>
<h2>What's my string?</h2>
</section>
<section>
<h2>Lists and strings</h2>
</section>
<section>
<h2>Historical note on the string module</h2>
</section>
<section>
<h2>Byte streams</h2>
</section>
<section>
<h2>Summary</h2>
</section>
</section>
<section>
<h1>The power of introspection</h1>
<section>
<h2>Diving in</h2>
</section>
<section>
<h2>Using optional and named arguments</h2>
<h3>Keyword-only arguments</h3>
</section>
<section>
<h2>Using type, str, dir, and other built-in functions</h2>
<h3>The type function</h3>
<h3>The str function</h3>
<h3>Built-in functions</h3>
</section>
<section>
<h2>Getting object references with getattr</h2>
<h3>getattr with modules</h3>
<h3>getattr as a dispatcher</h3>
</section>
<section>
<h2>Filtering lists</h2>
</section>
<section>
<h2>The peculiar nature of and and or</h2>
<h3>Using the and-or trick</h3>
</section>
<section>
<h2>Using lambda functions</h2>
<h3>Real-world lambda functions</h3>
</section>
<section>
<h2>Putting it all together</h2>
</section>
<section>
<h2>Summary</h2>
</section>
</section>
<section>
<h1>Objects and object-orientation</h1>
<section>
<h2>...major changes afoot...</h2>
<h2>...stuff about decorators...</h2>
<h2>...stuff about importing modules...</h2>
<h3>...mention why "from module import *" is only allowed at module level</h3>
</section>
</section>
<section>
<h1>Exceptions</h1>
<section>
<h2>...</h2>
</section>
</section>
<section>
<h1>Files</h1>
<section>
<h2>File objects</h2>
</section>
<section>
<h2>Reading files</h2>
</section>
<section>
<h2>Close your files... or don't</h2>
</section>
<section>
<h2>Handling I/O errors</h2>
</section>
<section>
<h2>Writing to files</h2>
</section>
</section>
<section>
<h1>Regular expressions</h1>
<section>
<h2>Diving in</h2>
</section>
<section>
<h2>Case study: street addresses</h2>
</section>
<section>
<h2>Case study: Roman numerals</h2>
<h3>Checking for thousands</h3>
<h3>Checking for hundreds</h3>
</section>
<section>
<h2>Using the {n,m} syntax</h2>
<h3>Checking for tens and ones</h3>
</section>
<section>
<h2>Verbose regular expressions</h2>
</section>
<section>
<h2>Case study: parsing phone numbers</h2>
</section>
<section>
<h2>Summary</h2>
</section>
</section>
<section>
<h1>HTML processing</h1>
<section>
<h2>Diving in</h2>
</section>
<section>
<h2>html5lib</h2>
<h3>Installing html5lib</h3>
<h3>Using html5lib</h3>
</section>
<section>
<h2>Extracting data from HTML documents</h2>
</section>
<section>
<h2>Building HTML documents</h2>
</section>
<section>
<h2>Putting it all together</h2>
</section>
<section>
<h2>Summary</h2>
</section>
</section>
<section>
<h1>XML Processing</h1>
<section>
<h2>...major changes afoot...</h2>
</section>
</section>
<section>
<h1>HTTP web services</h1>
<section>
<h2>Diving in</h2>
</section>
<section>
<h2>How not to fetch data over HTTP</h2>
</section>
<section>
<h2>Features of HTTP</h2>
<h3>User-Agent</h3>
<h3>Redirects</h3>
<h3>Last-Modified/If-Modified-Since</h3>
<h3>ETag-If-None-Match</h3>
<h3>Compression</h3>
</section>
<section>
<h2>Differences from Python 2</h2>
</section>
<section>
<h2>httplib2 (note: needs port)</h2>
<h3>Installing httplib2</h3>
<h3>Why httplib2 is better than http.client</h3>
</section>
<section>
<h2>Debugging HTTP web services</h2>
</section>
<section>
<h2>Setting the User-Agent</h2>
</section>
<section>
<h2>Handling Last-Modified and ETag</h2>
</section>
<section>
<h2>Handling redirects</h2>
</section>
<section>
<h2>Handling compressed data</h2>
</section>
<section>
<h2>Putting it all together</h2>
</section>
<section>
<h2>Summary</h2>
</section>
</section>
<section>
<h1>Unit testing</h1>
<section>
<h2>Introduction to Roman numerals</h2>
</section>
<section>
<h2>Diving in</h2>
</section>
<section>
<h2>Introducing romantest.py</h2>
</section>
<section>
<h2>Testing for success</h2>
</section>
<section>
<h2>Testing for failure</h2>
</section>
<section>
<h2>Testing for sanity</h2>
</section>
</section>
<section>
<h1>Test-first programming</h1>
<section>
<h2>roman.py, stage 1</h2>
</section>
<section>
<h2>roman.py, stage 2</h2>
</section>
<section>
<h2>roman.py, stage 3</h2>
</section>
<section>
<h2>roman.py, stage 4</h2>
</section>
<section>
<h2>roman.py, stage 5</h2>
</section>
</section>
<section>
<h1>Refactoring your code</h1>
<section>
<h2>Handling bugs</h2>
</section>
<section>
<h2>Handling changing requirements</h2>
</section>
<section>
<h2>The art of refactoring</h2>
</section>
<section>
<h2>Postscript</h2>
</section>
<section>
<h2>Summary</h2>
</section>
</section>
<section>
<h1>Dynamic functions</h1>
<section>
<h2>Diving in</h2>
</section>
<section>
<h2>plural.py, stage 1</h2>
</section>
<section>
<h2>plural.py, stage 2</h2>
</section>
<section>
<h2>plural.py, stage 3</h2>
</section>
<section>
<h2>plural.py, stage 4</h2>
</section>
<section>
<h2>plural.py, stage 5</h2>
</section>
<section>
<h2>plural.py, stage 6</h2>
</section>
<section>
<h2>Summary</h2>
</section>
</section>
<section>
<h1>Metaclasses</h1>
<section>
<h2>...once I figure out WTF metaclasses are...</h2>
</section>
</section>
<section>
<h1>Performance tuning</h1>
<section>
<h2>Diving in</h2>
</section>
<section>
<h2>Using the timeit module</h2>
</section>
<section>
<h2>Optimizing regular expressions</h2>
</section>
<section>
<h2>Optimizing dictionary lookups</h2>
</section>
<section>
<h2>Optimizing list operations</h2>
</section>
<section>
<h2>Optimizing string manipulation</h2>
</section>
<section>
<h2>Summary</h2>
</section>
</section>
<section>
<h1><a href="case-study-porting-chardet-to-python-3.html">Case study: porting <code>chardet</code> to Python 3</a></h1>
<section>
<h2><a href="#faq">Introducing <code class="filename">chardet</code>: a mini-FAQ</a></h2>
<h3><a href="#faq.what">What is character encoding auto-detection?</a></h3>
<h3><a href="#faq.impossible">Isn't that impossible?</a></h3>
<h3><a href="#faq.who">Who wrote this detection algorithm?</a></h3>
<h3><a href="#faq.yippie">Yippie! Screw the standards, I'll just auto-detect everything!</a></h3>
<h3><a href="#faq.why">Why bother with auto-detection if it's slow, inaccurate, and non-standard?</a></h3>
<h2><a href="#divingin">Diving in</a></h2>
</section>
<section>
<h3><a href="#how.bom"><code>UTF-n</code> with a <abbr title="Byte Order Mark">BOM</abbr></a></h3>
<h3><a href="#how.esc">Escaped encodings</a></h3>
<h3><a href="#how.mb">Multi-byte encodings</a></h3>
<h3><a href="#how.sb">Single-byte encodings</a></h3>
<h3><a href="#how.windows1252"><code>windows-1252</code></a></h3>
<h2><a href="#running2to3">Running <code class="filename">2to3</code></a></h2>
</section>
<h2><a href="#manual">Fixing what <code class="filename">2to3</code> can't</a></h2>
<h3><a href="#falseisinvalidsyntax"><code>False</code> is invalid syntax</a></h3>
<h3><a href="#nomodulenamedconstants">No module named <code class="filename">constants</code></a></h3>
<h3><a href="#namefileisnotdefined">Name '<var>file</var>' is not defined</a></h3>
<h3><a href="#cantuseastringpattern">Can't use a string pattern on a bytes-like object</a></h3>
<h3><a href="#cantconvertbytesobject">Can't convert '<code>bytes</code>' object to <code>str</code> implicitly</a></h3>
<section>
<h2><a href="#falseisinvalidsyntax"><code>False</code> is invalid syntax</a></h2>
</section>
<section>
<h2><a href="#nomodulenamedconstants">No module named <code class="filename">constants</code></a></h2>
</section>
<section>
<h2><a href="#namefileisnotdefined">Name '<var>file</var>' is not defined</a></h2>
</section>
<section>
<h2><a href="#cantuseastringpattern">Can't use a string pattern on a bytes-like object</a></h2>
</section>
<section>
<h2><a href="#cantconvertbytesobject">Can't convert '<code>bytes</code>' object to <code>str</code> implicitly</a></h2>
</section>
</section>
<section>
<h1>Packaging Python libraries</h1>
<!-- http://pypi.python.org/pypi -->
<section>
<h2>A brief history of packaging (and why it's harder than you think)</h2>
</section>
<section>
<h2>setuptools</h2>
</section>
<section>
<h2>distutils</h2>
</section>
<section>
<h2>Eggs</h2>
</section>
<section>
<h2>pip</h2>
</section>
<section>
<h2>Platform-specific packaging</h2>
<h3>Packaging by Linux distributions</h3>
<h3>Py2exe</h3>
</section>
</section>
<section>
<h1>Creating graphics with the Python Imaging Library</h1>
<section>
<h2>...<a href="http://www.reddit.com/r/Python/comments/7sj39/dive_into_python_3/c07b3cq">will likely get ported in time</a>...</h2>
</section>
</section>
<section>
<h1>Where to go from here</h1>
<p>Tentative because most of these have not been ported to Python 3 yet.</p>
<section>
<h2>WSGI</h2>
</section>
<section>
<h2>Django</h2>
</section>
<section>
<h2>Pylons</h2>
</section>
<section>
<h2>TurboGears</h2>
</section>
<section>
<h2>AppEngine</h2>
</section>
<section>
<h2>IronPython</h2>
</section>
<section>
<h2>Jython</h2>
</section>
<section>
<h2>PyPy</h2>
</section>
<section>
<h2>Stackless Python</h2>
</section>
</section>
<section>
<h1><del>Scripts and streams</del></h1>
<section>
<h2>...will be folded into other chapters...</h2>
</section>
</section>
<section>
<h1><del>Functional programming</del></h1>
<section>
<h2>...bits and pieces will be folded into other chapters...</h2>
</section>
</section>
<section>
<h1><del>SOAP web services</del></h1>
<section>
<h2>...no one will miss you...</h2>
</section>
</section>
<div class="appendix">
<h1 class="appendix">Appendix A. <a href="porting-code-to-python-3-with-2to3.html">Porting code to Python 3 with <code class="filename">2to3</code></a></h1>
<h2><a href="#divingin">Diving in</a></h2>
<h2><a href="#print"><code>print</code> statement</a></h2>
<h2><a href="#ne">&lt;> comparison</a></h2>
<h2><a href="#has_key"><code>has_key()</code> dictionary method</a></h2>
<h2><a href="#dict">Dictionary methods that return lists</a></h2>
<h2><a href="#imports">Modules that have been renamed or reorganized</a></h2>
<h3><a href="#http"><code>http</code> package</a></h3>
<h3><a href="#urllib"><code>urllib</code> package</a></h3>
<h3><a href="#dbm"><code>dbm</code> package</a></h3>
<h3><a href="#xmlrpc"><code>xmlrpc</code> package</a></h3>
<h3><a href="#othermodules">Other modules</a></h3>
<h2><a href="#import">Relative imports within a package</a></h2>
<h2><a href="#filter"><code>filter()</code> global function</a></h2>
<h2><a href="#map"><code>map()</code> global function</a></h2>
<h2><a href="#reduce"><code>reduce()</code> global function (3.1+)</a></h2>
<h2><a href="#apply"><code>apply()</code> global function</a></h2>
<h2><a href="#intern"><code>intern()</code> global function</a></h2>
<h2><a href="#exec"><code>exec</code> statement</a></h2>
<h2><a href="#execfile"><code>execfile</code> statement (3.1+)</a></h2>
<h2><a href="#repr"><code>repr</code> literals (backticks)</a></h2>
<h2><a href="#except"><code>try...except</code> statement</a></h2>
<h2><a href="#raise"><code>raise</code> statement</a></h2>
<h2><a href="#throw"><code>throw</code> statement</a></h2>
<h2><a href="#long"><code>long</code> data type</a></h2>
<h2><a href="#xrange"><code>xrange()</code> global function</a></h2>
<h2><a href="#raw_input"><code>raw_input()</code> and <code>input()</code> global functions</a></h2>
<h2><a href="#funcattrs"><code>func_*</code> function attributes</a></h2>
<h2><a href="#xreadlines"><code>xreadlines()</code> I/O method</a></h2>
<h2><a href="#tuple_params"><code>lambda</code> functions with multiple parameters</a></h2>
<h2><a href="#methodattrs">Special method attributes</a></h2>
<h2><a href="#next"><code>next()</code> iterator method</a></h2>
<h2><a href="#nonzero"><code>__nonzero__</code> special class attribute</a></h2>
<h2><a href="#numliterals">Number literals</a></h2>
<h2><a href="#renames"><code>sys.maxint</code></a></h2>
<h2><a href="#unicode"><code>unicode()</code> global function</a></h2>
<h2><a href="#unicodeliteral">Unicode string literals</a></h2>
<h2><a href="#callable"><code>callable()</code> global function</a></h2>
<h2><a href="#zip"><code>zip()</code> global function</a></h2>
<h2><a href="#standarderror"><code>StandardError()</code> exception</a></h2>
<h2><a href="#types"><code class="filename">types</code> module constants</a></h2>
<h2><a href="#isinstance"><code>isinstance</code> global function (3.1+)</a></h2>
<h2><a href="#basestring"><code>basestring</code> datatype</a></h2>
<h2><a href="#itertools"><code class="filename">itertools</code> module</a></h2>
<h2><a href="#sys_exc"><code>sys.exc_type</code>, <code>sys.exc_value</code>, <code>sys.exc_traceback</code></a></h2>
<h2><a href="#paren">List comprehensions over tuples</a></h2>
<h2><a href="#getcwdu"><code>os.getcwdu()</code> function</a></h2>
<h2><a href="#metaclass">Metaclasses</a></h2>
<h2><a href="#set_literal"><code>set()</code> literals</a></h2>
<h2><a href="#buffer"><code>buffer()</code> global function</a></h2>
<h2><a href="#wscomma">Whitespace around commas</a></h2>
<h2><a href="#idioms">Common idioms</a></h2>
</div>
<footer>
<p class="c">This site is optimized for Lynx just because fuck you.<br>I'm told it also looks good in graphical browsers.</p>
<p class="c">&copy; 2001-4, 2009 Mark Pilgrim, <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">CC-BY-3.0</a></p>
</footer>
</body>
</html>