Commits

Bruce Eckel committed deacf88

Incorporated Michael Charlton's additions to the Comprehensions chapter.
Also added various notes here and there.

/Users/bruceeckel/Downloads/workoncomprehensionschapterforpython3patternsidio/idMatrix.png /Users/bruceeckel/Downloads/workoncomprehensionschapterforpython3patternsidio/listComprehensions.gif /Users/bruceeckel/Downloads/workoncomprehensionschapterforpython3patternsidio/idMatrix.png /Users/bruceeckel/Downloads/workoncomprehensionschapterforpython3patternsidio/listComprehensions.gif HG: changed html/objects.inv

Comments (0)

Files changed (62)

.DS_Store

Binary file modified.

code/.DS_Store

Binary file modified.

html/AppFrameworks.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Fronting for an Implementation" href="Fronting.html" />
-    <link rel="prev" title="The Singleton" href="Singleton.html" />
+    <link rel="prev" title="The Singleton" href="Singleton.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="Singleton.html" title="The Singleton"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="building-application-frameworks">
 <h1>Building Application Frameworks<a class="headerlink" href="#building-application-frameworks" title="Permalink to this headline">¶</a></h1>
 <p>An application framework allows you to inherit from a class or set of classes
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="Singleton.html" title="previous chapter">The Singleton</a></p>
+            <p class="topless"><a href="Singleton.html"
+                                  title="previous chapter">The Singleton</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="Fronting.html" title="next chapter">Fronting for an Implementation</a></p>
+            <p class="topless"><a href="Fronting.html"
+                                  title="next chapter">Fronting for an Implementation</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/AppFrameworks.txt">Show Source</a></li>
+              <li><a href="_sources/AppFrameworks.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="Singleton.html" title="The Singleton"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/CanonicalScript.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Messenger/Data Transfer Object" href="Messenger.html" />
-    <link rel="prev" title="Discovering the Details About Your Platform" href="MachineDiscovery.html" />
+    <link rel="prev" title="Discovering the Details About Your Platform" href="MachineDiscovery.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="MachineDiscovery.html" title="Discovering the Details About Your Platform"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="a-canonical-form-for-command-line-programs">
 <span id="index-0"></span><h1>A Canonical Form for Command-Line Programs<a class="headerlink" href="#a-canonical-form-for-command-line-programs" title="Permalink to this headline">¶</a></h1>
 <p>Creating Python programs for command-line use involves a certain amount of
     
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="MachineDiscovery.html" title="previous chapter">Discovering the Details About Your Platform</a></p>
+            <p class="topless"><a href="MachineDiscovery.html"
+                                  title="previous chapter">Discovering the Details About Your Platform</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="Messenger.html" title="next chapter">Messenger/Data Transfer Object</a></p>
+            <p class="topless"><a href="Messenger.html"
+                                  title="next chapter">Messenger/Data Transfer Object</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/CanonicalScript.txt">Show Source</a></li>
+              <li><a href="_sources/CanonicalScript.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="MachineDiscovery.html" title="Discovering the Details About Your Platform"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/ChangeInterface.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Table-Driven Code: Configuration Flexibility" href="TableDriven.html" />
-    <link rel="prev" title="Function Objects" href="FunctionObjects.html" />
+    <link rel="prev" title="Function Objects" href="FunctionObjects.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="FunctionObjects.html" title="Function Objects"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="changing-the-interface">
 <h1>Changing the Interface<a class="headerlink" href="#changing-the-interface" title="Permalink to this headline">¶</a></h1>
 <p>Sometimes the problem that you&#8217;re solving is as simple as &#8220;I don&#8217;t have the
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="FunctionObjects.html" title="previous chapter">Function Objects</a></p>
+            <p class="topless"><a href="FunctionObjects.html"
+                                  title="previous chapter">Function Objects</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="TableDriven.html" title="next chapter">Table-Driven Code: Configuration Flexibility</a></p>
+            <p class="topless"><a href="TableDriven.html"
+                                  title="next chapter">Table-Driven Code: Configuration Flexibility</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/ChangeInterface.txt">Show Source</a></li>
+              <li><a href="_sources/ChangeInterface.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="FunctionObjects.html" title="Function Objects"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/Comprehensions.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="index" title="Index" href="genindex.html" />
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
-    <link rel="next" title="Coroutines &amp; Concurrency" href="CoroutinesAndConcurrency.html" />
-    <link rel="prev" title="Generators, Iterators, and Itertools" href="GeneratorsIterators.html" />
+    <link rel="next" title="Coroutines, Concurrency & Distributed Systems" href="CoroutinesAndConcurrency.html" />
+    <link rel="prev" title="Generators, Iterators, and Itertools" href="GeneratorsIterators.html" /> 
   </head>
   <body>
     <div class="related">
           <a href="genindex.html" title="General Index"
              accesskey="I">index</a></li>
         <li class="right" >
-          <a href="CoroutinesAndConcurrency.html" title="Coroutines &amp; Concurrency"
+          <a href="CoroutinesAndConcurrency.html" title="Coroutines, Concurrency & Distributed Systems"
              accesskey="N">next</a> |</li>
         <li class="right" >
           <a href="GeneratorsIterators.html" title="Generators, Iterators, and Itertools"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="comprehensions">
 <span id="index-1"></span><h1>Comprehensions<a class="headerlink" href="#comprehensions" title="Permalink to this headline">¶</a></h1>
 <p>History: where did they come from?</p>
 <p>They require a mind shift.</p>
 <p>What makes them so compelling (once you &#8216;get it&#8217;)?</p>
+<p>Comprehensions are constructs that allow sequences to be built from other sequences. Python 2.0 introduced list comprehensions and Python 3.0 comes with dictionary and set comprehensions.</p>
+<div class="section" id="list-comprehensions">
+<h2>List Comprehensions<a class="headerlink" href="#list-comprehensions" title="Permalink to this headline">¶</a></h2>
+<p>A list comprehension consists of the following parts:</p>
+<ul class="simple">
+<li>An Input Sequence.</li>
+<li>A Variable representing members of the input sequence.</li>
+<li>An Optional Predicate expression.</li>
+<li>An Output Expression producing elements of the output list from members of the Input Sequence that satisfy the predicate.</li>
+</ul>
+<p>Say we need to obtain a list of all the integers in a sequence and then square them:</p>
+<div class="highlight-python"><pre>a_list = [1, ‘4’, 9, ‘a’, 0, 4]
+
+squared_ints = [ e**2 for e in a_list if type(e) == types.IntType ]
+
+print squared_ints
+# [ 1, 81, 0, 16 ]</pre>
+</div>
+<img alt="_images/listComprehensions.gif" src="_images/listComprehensions.gif" />
+<ul class="simple">
+<li>The iterator part iterates through each member <strong>e</strong> of the input sequence <strong>a_list</strong>.</li>
+<li>The predicate checks if the member is an integer.</li>
+<li>If the member is an integer then it is passed to the output expression, squared, to become a member of the output list.</li>
+</ul>
+<p>Much the same results can be achieved using the built in functions, <strong>map</strong>, <strong>filter</strong> and the anonymous <strong>lambda</strong> function.</p>
+<p>The filter function applies a predicate to a sequence:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nb">filter</span><span class="p">(</span><span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="nb">type</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="o">==</span> <span class="n">types</span><span class="o">.</span><span class="n">IntType</span><span class="p">,</span> <span class="n">a_list</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Map modifies each member of a sequence:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nb">map</span><span class="p">(</span><span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="n">e</span><span class="o">**</span><span class="mf">2</span><span class="p">,</span> <span class="n">a_list</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>The two can be combined:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="nb">map</span><span class="p">(</span><span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="n">e</span><span class="o">**</span><span class="mf">2</span><span class="p">,</span> <span class="nb">filter</span><span class="p">(</span><span class="k">lambda</span> <span class="n">e</span><span class="p">:</span> <span class="nb">type</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="o">==</span> <span class="n">types</span><span class="o">.</span><span class="n">IntType</span><span class="p">,</span> <span class="n">a_list</span><span class="p">))</span>
+</pre></div>
+</div>
+<p>The above example involves function calls to <strong>map</strong>, <strong>filter</strong>, <strong>type</strong> and two calls to <strong>lambda</strong>. Function calls in Python are expensive. Furthermore the input sequence is traversed through twice and an intermediate list is produced by filter.</p>
+<p>The list comprehension is enclosed within a list so, it is immediately evident that a list is being produced. There is only one function call to <strong>type</strong> and no call to the cryptic <strong>lambda</strong> instead the list comprehension uses a conventional iterator, an expression and an if expression for the optional predicate.</p>
+</div>
+<div class="section" id="nested-comprehensions">
+<h2>Nested Comprehensions<a class="headerlink" href="#nested-comprehensions" title="Permalink to this headline">¶</a></h2>
+<p>An identity matrix of size n is an n by n square matrix with ones on the main diagonal and zeros elsewhere. A 3 by 3 identity matrix is:</p>
+<img alt="_images/idMatrix.png" src="_images/idMatrix.png" />
+<p>In python we can represent such a matrix by a list of lists, where each sub-list represents a row. A 3 by 3 matrix would be represented by the following list:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="p">[</span> <span class="p">[</span> <span class="mf">1</span><span class="p">,</span> <span class="mf">0</span><span class="p">,</span> <span class="mf">1</span> <span class="p">],</span>
+  <span class="p">[</span> <span class="mf">0</span><span class="p">,</span> <span class="mf">1</span><span class="p">,</span> <span class="mf">0</span> <span class="p">],</span>
+  <span class="p">[</span> <span class="mf">0</span><span class="p">,</span> <span class="mf">0</span><span class="p">,</span> <span class="mf">1</span> <span class="p">]</span> <span class="p">]</span>
+</pre></div>
+</div>
+<p>The above matrix can be generated by the following comprehension:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="p">[</span> <span class="p">[</span> <span class="mf">1</span> <span class="k">if</span> <span class="n">item_idx</span> <span class="o">==</span> <span class="n">row_idx</span> <span class="k">else</span> <span class="mf">0</span> <span class="k">for</span> <span class="n">item_idx</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">0</span><span class="p">,</span> <span class="mf">3</span><span class="p">)</span> <span class="p">]</span> <span class="k">for</span> <span class="n">row_idx</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mf">0</span><span class="p">,</span> <span class="mf">3</span><span class="p">)</span> <span class="p">]</span>
+</pre></div>
+</div>
+</div>
 <div class="section" id="techniques">
 <h2>Techniques<a class="headerlink" href="#techniques" title="Permalink to this headline">¶</a></h2>
 <p>Using <tt class="docutils literal"><span class="pre">zip()</span></tt> and dealing with two or more elements at a time:</p>
 </pre></div>
 </div>
 </div>
+<div class="section" id="set-comprehensions">
+<h2>Set Comprehensions<a class="headerlink" href="#set-comprehensions" title="Permalink to this headline">¶</a></h2>
+<p>Set comprehensions allow sets to be constructed using the same principles as list comprehensions, the only difference is that resulting sequence is a set.</p>
+<p>Say we have a list of names. The list can contain names which only differ in the case used to represent them,   duplicates and names consisting of only one character. We are only interested in names longer then one character and wish to represent all names in the same format: The first letter should be capitalised, all other characters should be lower case.</p>
+<p>Given the list:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="n">names</span> <span class="o">=</span> <span class="p">[</span> <span class="s">&#39;Bob&#39;</span><span class="p">,</span> <span class="s">&#39;JOHN&#39;</span><span class="p">,</span> <span class="s">&#39;alice&#39;</span><span class="p">,</span> <span class="s">&#39;bob&#39;</span><span class="p">,</span> <span class="s">&#39;ALICE&#39;</span><span class="p">,</span> <span class="s">&#39;J&#39;</span><span class="p">,</span> <span class="s">&#39;Bob&#39;</span> <span class="p">]</span>
+</pre></div>
+</div>
+<p>We require the set:</p>
+<div class="highlight-python"><pre>{ 'Bob', 'John', 'Alice' }</pre>
+</div>
+<p>Note the new syntax for denoting a set. Members are enclosed in curly braces.</p>
+<p>The following set comprehension accomplishes this:</p>
+<div class="highlight-python"><pre>{ name[0].upper() + name[1:].lower() for name in names if len(name) &gt; 1 }</pre>
+</div>
+</div>
+<div class="section" id="dictionary-comprehensions">
+<h2>Dictionary Comprehensions<a class="headerlink" href="#dictionary-comprehensions" title="Permalink to this headline">¶</a></h2>
+<p>Say we have a dictionary the keys of which are characters and the values of which map to the number of times that character appears in some text. The dictionary currently distinguishes between upper and lower case characters.</p>
+<p>We require a dictionary in which the occurrences of upper and lower case characters are combined:</p>
+<div class="highlight-python"><pre>mcase = {'a':10, 'b': 34, 'A': 7, 'Z':3}
+
+mcase_frequency = { k.lower() : mcase.get(k.lower(), 0) + mcase.get(k.upper(), 0) for k in mcase.keys() }
+
+# mcase_frequency == {'a': 17, 'z': 3, 'b': 34}</pre>
+</div>
+<div class="admonition note">
+<p class="first admonition-title">Note</p>
+<p class="last">Contributions by Michael Charlton, 3/23/09</p>
+</div>
+</div>
 </div>
 
 
             <h3><a href="index.html">Table Of Contents</a></h3>
             <ul>
 <li><a class="reference external" href="">Comprehensions</a><ul>
+<li><a class="reference external" href="#list-comprehensions">List Comprehensions</a></li>
+<li><a class="reference external" href="#nested-comprehensions">Nested Comprehensions</a></li>
 <li><a class="reference external" href="#techniques">Techniques</a></li>
 <li><a class="reference external" href="#a-more-complex-example">A More Complex Example</a></li>
+<li><a class="reference external" href="#set-comprehensions">Set Comprehensions</a></li>
+<li><a class="reference external" href="#dictionary-comprehensions">Dictionary Comprehensions</a></li>
 </ul>
 </li>
 </ul>
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="GeneratorsIterators.html" title="previous chapter">Generators, Iterators, and Itertools</a></p>
+            <p class="topless"><a href="GeneratorsIterators.html"
+                                  title="previous chapter">Generators, Iterators, and Itertools</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="CoroutinesAndConcurrency.html" title="next chapter">Coroutines &amp; Concurrency</a></p>
+            <p class="topless"><a href="CoroutinesAndConcurrency.html"
+                                  title="next chapter">Coroutines, Concurrency &amp; Distributed Systems</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/Comprehensions.txt">Show Source</a></li>
+              <li><a href="_sources/Comprehensions.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
           <a href="genindex.html" title="General Index"
              accesskey="I">index</a></li>
         <li class="right" >
-          <a href="CoroutinesAndConcurrency.html" title="Coroutines &amp; Concurrency"
+          <a href="CoroutinesAndConcurrency.html" title="Coroutines, Concurrency & Distributed Systems"
              accesskey="N">next</a> |</li>
         <li class="right" >
           <a href="GeneratorsIterators.html" title="Generators, Iterators, and Itertools"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/Contributors.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="ToDo List" href="ToDo.html" />
-    <link rel="prev" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
+    <link rel="prev" title="Python 3 Patterns, Recipes and Idioms" href="index.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="index.html" title="Python 3 Patterns, Recipes and Idioms"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="contributors">
 <h1>Contributors<a class="headerlink" href="#contributors" title="Permalink to this headline">¶</a></h1>
 <p>List of contributors.</p>
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="index.html" title="previous chapter">Python 3 Patterns, Recipes and Idioms</a></p>
+            <p class="topless"><a href="index.html"
+                                  title="previous chapter">Python 3 Patterns, Recipes and Idioms</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="ToDo.html" title="next chapter">ToDo List</a></p>
+            <p class="topless"><a href="ToDo.html"
+                                  title="next chapter">ToDo List</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/Contributors.txt">Show Source</a></li>
+              <li><a href="_sources/Contributors.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="index.html" title="Python 3 Patterns, Recipes and Idioms"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/CoroutinesAndConcurrency.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
-    <title>Coroutines &amp; Concurrency &mdash; Python 3 Patterns, Recipes and Idioms</title>
+    <title>Coroutines, Concurrency & Distributed Systems &mdash; Python 3 Patterns, Recipes and Idioms</title>
     <link rel="stylesheet" href="_static/default.css" type="text/css" />
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Metaclasses" href="Metaclasses.html" />
-    <link rel="prev" title="Comprehensions" href="Comprehensions.html" />
+    <link rel="prev" title="Comprehensions" href="Comprehensions.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="Comprehensions.html" title="Comprehensions"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
-  <div class="section" id="coroutines-concurrency">
-<span id="index-3"></span><h1>Coroutines &amp; Concurrency<a class="headerlink" href="#coroutines-concurrency" title="Permalink to this headline">¶</a></h1>
+  <div class="section" id="coroutines-concurrency-distributed-systems">
+<span id="index-3"></span><h1>Coroutines, Concurrency &amp; Distributed Systems<a class="headerlink" href="#coroutines-concurrency-distributed-systems" title="Permalink to this headline">¶</a></h1>
 <p>Primary focus should be on:</p>
 <ol class="arabic simple">
 <li>Using <tt class="docutils literal"><span class="pre">yield</span></tt> to create coroutines</li>
 </ol>
 <p>and then showing some alternative techniques.</p>
 <p>foo bar <tt class="xref docutils literal"><span class="pre">input()</span></tt> baz.</p>
+<div class="section" id="multiprocessing">
+<h2>Multiprocessing<a class="headerlink" href="#multiprocessing" title="Permalink to this headline">¶</a></h2>
+<p>Example by Michele Simionato in comp lang python.
+Here is an example of using multiprocessing (which is included
+in Python 2.6 and easy_installable in older Python versions)
+to print a spin bar while a computation is running:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sys</span><span class="o">,</span> <span class="nn">time</span>
+<span class="kn">import</span> <span class="nn">multiprocessing</span>
+<span class="n">DELAY</span> <span class="o">=</span> <span class="mf">0.1</span>
+<span class="n">DISPLAY</span> <span class="o">=</span> <span class="p">[</span> <span class="s">&#39;|&#39;</span><span class="p">,</span> <span class="s">&#39;/&#39;</span><span class="p">,</span> <span class="s">&#39;-&#39;</span><span class="p">,</span> <span class="s">&#39;</span><span class="se">\\</span><span class="s">&#39;</span> <span class="p">]</span>
+<span class="k">def</span> <span class="nf">spinner_func</span><span class="p">(</span><span class="n">before</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">,</span> <span class="n">after</span><span class="o">=</span><span class="s">&#39;&#39;</span><span class="p">):</span>
+    <span class="n">write</span><span class="p">,</span> <span class="n">flush</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">write</span><span class="p">,</span> <span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">flush</span>
+    <span class="n">pos</span> <span class="o">=</span> <span class="o">-</span><span class="mf">1</span>
+    <span class="k">while</span> <span class="bp">True</span><span class="p">:</span>
+        <span class="n">pos</span> <span class="o">=</span> <span class="p">(</span><span class="n">pos</span> <span class="o">+</span> <span class="mf">1</span><span class="p">)</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">DISPLAY</span><span class="p">)</span>
+        <span class="n">msg</span> <span class="o">=</span> <span class="n">before</span> <span class="o">+</span> <span class="n">DISPLAY</span><span class="p">[</span><span class="n">pos</span><span class="p">]</span> <span class="o">+</span> <span class="n">after</span>
+        <span class="n">write</span><span class="p">(</span><span class="n">msg</span><span class="p">);</span> <span class="n">flush</span><span class="p">()</span>
+        <span class="n">write</span><span class="p">(</span><span class="s">&#39;</span><span class="se">\x08</span><span class="s">&#39;</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">msg</span><span class="p">))</span>
+        <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="n">DELAY</span><span class="p">)</span>
+<span class="k">def</span> <span class="nf">long_computation</span><span class="p">():</span>
+    <span class="c"># emulate a long computation</span>
+    <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">3</span><span class="p">)</span>
+<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">&#39;__main__&#39;</span><span class="p">:</span>
+    <span class="n">spinner</span> <span class="o">=</span> <span class="n">multiprocessing</span><span class="o">.</span><span class="n">Process</span><span class="p">(</span>
+        <span class="bp">None</span><span class="p">,</span> <span class="n">spinner_func</span><span class="p">,</span> <span class="n">args</span><span class="o">=</span><span class="p">(</span><span class="s">&#39;Please wait ... &#39;</span><span class="p">,</span> <span class="s">&#39;&#39;</span><span class="p">))</span>
+    <span class="n">spinner</span><span class="o">.</span><span class="n">start</span><span class="p">()</span>
+    <span class="k">try</span><span class="p">:</span>
+        <span class="n">long_computation</span><span class="p">()</span>
+        <span class="k">print</span> <span class="s">&#39;Computation done&#39;</span>
+    <span class="k">finally</span><span class="p">:</span>
+        <span class="n">spinner</span><span class="o">.</span><span class="n">terminate</span><span class="p">()</span>
+</pre></div>
+</div>
+</div>
 <div class="section" id="further-reading">
 <h2>Further Reading<a class="headerlink" href="#further-reading" title="Permalink to this headline">¶</a></h2>
 <blockquote>
     
             <h3><a href="index.html">Table Of Contents</a></h3>
             <ul>
-<li><a class="reference external" href="">Coroutines &amp; Concurrency</a><ul>
+<li><a class="reference external" href="">Coroutines, Concurrency &amp; Distributed Systems</a><ul>
+<li><a class="reference external" href="#multiprocessing">Multiprocessing</a></li>
 <li><a class="reference external" href="#further-reading">Further Reading</a></li>
 </ul>
 </li>
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="Comprehensions.html" title="previous chapter">Comprehensions</a></p>
+            <p class="topless"><a href="Comprehensions.html"
+                                  title="previous chapter">Comprehensions</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="Metaclasses.html" title="next chapter">Metaclasses</a></p>
+            <p class="topless"><a href="Metaclasses.html"
+                                  title="next chapter">Metaclasses</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/CoroutinesAndConcurrency.txt">Show Source</a></li>
+              <li><a href="_sources/CoroutinesAndConcurrency.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="Comprehensions.html" title="Comprehensions"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/Decorator.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Iterators: Decoupling Algorithms from Containers" href="Iterators.html" />
-    <link rel="prev" title="StateMachine" href="StateMachine.html" />
+    <link rel="prev" title="StateMachine" href="StateMachine.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="StateMachine.html" title="StateMachine"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="decorator-dynamic-type-selection">
 <h1>Decorator: Dynamic Type Selection<a class="headerlink" href="#decorator-dynamic-type-selection" title="Permalink to this headline">¶</a></h1>
 <div class="admonition note">
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="StateMachine.html" title="previous chapter">StateMachine</a></p>
+            <p class="topless"><a href="StateMachine.html"
+                                  title="previous chapter">StateMachine</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="Iterators.html" title="next chapter">Iterators: Decoupling Algorithms from Containers</a></p>
+            <p class="topless"><a href="Iterators.html"
+                                  title="next chapter">Iterators: Decoupling Algorithms from Containers</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/Decorator.txt">Show Source</a></li>
+              <li><a href="_sources/Decorator.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="StateMachine.html" title="StateMachine"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/DeveloperGuide.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Part I: Foundations" href="Part1.html" />
-    <link rel="prev" title="Book Development Rules" href="Rules.html" />
+    <link rel="prev" title="Book Development Rules" href="Rules.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="Rules.html" title="Book Development Rules"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="developer-guide">
 <h1>Developer Guide<a class="headerlink" href="#developer-guide" title="Permalink to this headline">¶</a></h1>
 <p>Details for people participating in the book development process.</p>
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="Rules.html" title="previous chapter">Book Development Rules</a></p>
+            <p class="topless"><a href="Rules.html"
+                                  title="previous chapter">Book Development Rules</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="Part1.html" title="next chapter">Part I: Foundations</a></p>
+            <p class="topless"><a href="Part1.html"
+                                  title="next chapter">Part I: Foundations</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/DeveloperGuide.txt">Show Source</a></li>
+              <li><a href="_sources/DeveloperGuide.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="Rules.html" title="Book Development Rules"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/Factory.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Function Objects" href="FunctionObjects.html" />
-    <link rel="prev" title="Iterators: Decoupling Algorithms from Containers" href="Iterators.html" />
+    <link rel="prev" title="Iterators: Decoupling Algorithms from Containers" href="Iterators.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="Iterators.html" title="Iterators: Decoupling Algorithms from Containers"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="factory-encapsulating-object-creation">
 <h1>Factory: Encapsulating Object Creation<a class="headerlink" href="#factory-encapsulating-object-creation" title="Permalink to this headline">¶</a></h1>
 <p>When you discover that you need to add new types to a system, the most sensible
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="Iterators.html" title="previous chapter">Iterators: Decoupling Algorithms from Containers</a></p>
+            <p class="topless"><a href="Iterators.html"
+                                  title="previous chapter">Iterators: Decoupling Algorithms from Containers</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="FunctionObjects.html" title="next chapter">Function Objects</a></p>
+            <p class="topless"><a href="FunctionObjects.html"
+                                  title="next chapter">Function Objects</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/Factory.txt">Show Source</a></li>
+              <li><a href="_sources/Factory.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="Iterators.html" title="Iterators: Decoupling Algorithms from Containers"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/Fronting.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="StateMachine" href="StateMachine.html" />
-    <link rel="prev" title="Building Application Frameworks" href="AppFrameworks.html" />
+    <link rel="prev" title="Building Application Frameworks" href="AppFrameworks.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="AppFrameworks.html" title="Building Application Frameworks"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="fronting-for-an-implementation">
 <h1>Fronting for an Implementation<a class="headerlink" href="#fronting-for-an-implementation" title="Permalink to this headline">¶</a></h1>
 <p>Both <em>Proxy</em> and <em>State</em> provide a surrogate class that you use in your code;
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="AppFrameworks.html" title="previous chapter">Building Application Frameworks</a></p>
+            <p class="topless"><a href="AppFrameworks.html"
+                                  title="previous chapter">Building Application Frameworks</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="StateMachine.html" title="next chapter">StateMachine</a></p>
+            <p class="topless"><a href="StateMachine.html"
+                                  title="next chapter">StateMachine</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/Fronting.txt">Show Source</a></li>
+              <li><a href="_sources/Fronting.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="AppFrameworks.html" title="Building Application Frameworks"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/FunctionObjects.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Changing the Interface" href="ChangeInterface.html" />
-    <link rel="prev" title="Factory: Encapsulating Object Creation" href="Factory.html" />
+    <link rel="prev" title="Factory: Encapsulating Object Creation" href="Factory.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="Factory.html" title="Factory: Encapsulating Object Creation"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="function-objects">
 <h1>Function Objects<a class="headerlink" href="#function-objects" title="Permalink to this headline">¶</a></h1>
 <p>In <em>Advanced C++:Programming Styles And Idioms (Addison-Wesley, 1992)</em>, Jim
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="Factory.html" title="previous chapter">Factory: Encapsulating Object Creation</a></p>
+            <p class="topless"><a href="Factory.html"
+                                  title="previous chapter">Factory: Encapsulating Object Creation</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="ChangeInterface.html" title="next chapter">Changing the Interface</a></p>
+            <p class="topless"><a href="ChangeInterface.html"
+                                  title="next chapter">Changing the Interface</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/FunctionObjects.txt">Show Source</a></li>
+              <li><a href="_sources/FunctionObjects.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="Factory.html" title="Factory: Encapsulating Object Creation"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/GeneratorsIterators.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Comprehensions" href="Comprehensions.html" />
-    <link rel="prev" title="Decorators" href="PythonDecorators.html" />
+    <link rel="prev" title="Decorators" href="PythonDecorators.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="PythonDecorators.html" title="Decorators"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="generators-iterators-and-itertools">
 <span id="index-7"></span><h1>Generators, Iterators, and Itertools<a class="headerlink" href="#generators-iterators-and-itertools" title="Permalink to this headline">¶</a></h1>
 </div>
     
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="PythonDecorators.html" title="previous chapter">Decorators</a></p>
+            <p class="topless"><a href="PythonDecorators.html"
+                                  title="previous chapter">Decorators</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="Comprehensions.html" title="next chapter">Comprehensions</a></p>
+            <p class="topless"><a href="Comprehensions.html"
+                                  title="next chapter">Comprehensions</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/GeneratorsIterators.txt">Show Source</a></li>
+              <li><a href="_sources/GeneratorsIterators.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="PythonDecorators.html" title="Decorators"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/InitializationAndCleanup.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="index" title="Index" href="genindex.html" />
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
-    <link rel="next" title="Unit Testing &amp; Test-Driven Development" href="UnitTesting.html" />
-    <link rel="prev" title="Python for Programmers" href="PythonForProgrammers.html" />
+    <link rel="next" title="Unit Testing & Test-Driven Development" href="UnitTesting.html" />
+    <link rel="prev" title="Python for Programmers" href="PythonForProgrammers.html" /> 
   </head>
   <body>
     <div class="related">
           <a href="genindex.html" title="General Index"
              accesskey="I">index</a></li>
         <li class="right" >
-          <a href="UnitTesting.html" title="Unit Testing &amp; Test-Driven Development"
+          <a href="UnitTesting.html" title="Unit Testing & Test-Driven Development"
              accesskey="N">next</a> |</li>
         <li class="right" >
           <a href="PythonForProgrammers.html" title="Python for Programmers"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="initialization-and-cleanup">
 <h1>Initialization and Cleanup<a class="headerlink" href="#initialization-and-cleanup" title="Permalink to this headline">¶</a></h1>
 <div class="section" id="initialization">
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="PythonForProgrammers.html" title="previous chapter">Python for Programmers</a></p>
+            <p class="topless"><a href="PythonForProgrammers.html"
+                                  title="previous chapter">Python for Programmers</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="UnitTesting.html" title="next chapter">Unit Testing &amp; Test-Driven Development</a></p>
+            <p class="topless"><a href="UnitTesting.html"
+                                  title="next chapter">Unit Testing &amp; Test-Driven Development</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/InitializationAndCleanup.txt">Show Source</a></li>
+              <li><a href="_sources/InitializationAndCleanup.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
           <a href="genindex.html" title="General Index"
              accesskey="I">index</a></li>
         <li class="right" >
-          <a href="UnitTesting.html" title="Unit Testing &amp; Test-Driven Development"
+          <a href="UnitTesting.html" title="Unit Testing & Test-Driven Development"
              accesskey="N">next</a> |</li>
         <li class="right" >
           <a href="PythonForProgrammers.html" title="Python for Programmers"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/Introduction.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Teaching Support" href="TeachingSupport.html" />
-    <link rel="prev" title="A Note To Readers" href="NoteToReaders.html" />
+    <link rel="prev" title="A Note To Readers" href="NoteToReaders.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="NoteToReaders.html" title="A Note To Readers"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="introduction">
 <h1>Introduction<a class="headerlink" href="#introduction" title="Permalink to this headline">¶</a></h1>
 <font size="+1">The vision for this book.</font><div class="section" id="a-team-effort">
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="NoteToReaders.html" title="previous chapter">A Note To Readers</a></p>
+            <p class="topless"><a href="NoteToReaders.html"
+                                  title="previous chapter">A Note To Readers</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="TeachingSupport.html" title="next chapter">Teaching Support</a></p>
+            <p class="topless"><a href="TeachingSupport.html"
+                                  title="next chapter">Teaching Support</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/Introduction.txt">Show Source</a></li>
+              <li><a href="_sources/Introduction.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="NoteToReaders.html" title="A Note To Readers"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>

html/Iterators.html

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Factory: Encapsulating Object Creation" href="Factory.html" />
-    <link rel="prev" title="Decorator: Dynamic Type Selection" href="Decorator.html" />
+    <link rel="prev" title="Decorator: Dynamic Type Selection" href="Decorator.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="Decorator.html" title="Decorator: Dynamic Type Selection"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-  
   <div class="section" id="iterators-decoupling-algorithms-from-containers">
 <h1>Iterators: Decoupling Algorithms from Containers<a class="headerlink" href="#iterators-decoupling-algorithms-from-containers" title="Permalink to this headline">¶</a></h1>
 <div class="admonition note">
 
 
             <h4>Previous topic</h4>
-            <p class="topless"><a href="Decorator.html" title="previous chapter">Decorator: Dynamic Type Selection</a></p>
+            <p class="topless"><a href="Decorator.html"
+                                  title="previous chapter">Decorator: Dynamic Type Selection</a></p>
             <h4>Next topic</h4>
-            <p class="topless"><a href="Factory.html" title="next chapter">Factory: Encapsulating Object Creation</a></p>
+            <p class="topless"><a href="Factory.html"
+                                  title="next chapter">Factory: Encapsulating Object Creation</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/Iterators.txt">Show Source</a></li>
+              <li><a href="_sources/Iterators.txt"
+                     rel="nofollow">Show Source</a></li>
             </ul>
     
-          <h3>Quick search</h3>
-            <form class="search" action="search.html" method="get">
-              <input type="text" name="q" size="18" /> <input type="submit" value="Go" />
-              <input type="hidden" name="check_keywords" value="yes" />
-              <input type="hidden" name="area" value="default" />
-            </form>
+	  <div id="searchbox" style="display: none">
+            <h3>Quick search</h3>
+              <form class="search" action="search.html" method="get">
+                <input type="text" name="q" size="18" />
+                <input type="submit" value="Go" />
+                <input type="hidden" name="check_keywords" value="yes" />
+                <input type="hidden" name="area" value="default" />
+              </form>
+	      <p style="font-size: 90%">Enter search terms or a module, class or function name.</p>
+          </div>
+          <script type="text/javascript">$('#searchbox').show(0);</script>
     <h4><a href="http://www.mindviewinc.com/Books/Python3Patterns/Index.php">Project Homepage</a></h4>
     <h4><a href="http://www.bitbucket.org/BruceEckel/python-3-patterns-idioms/issues/">Corrections/Suggestions</a></h4>
     <h4><a href="http://www.mindviewinc.com/Consulting/Index.php">Consulting &amp; Training</a></h4><br><br>
         <li class="right" >
           <a href="Decorator.html" title="Decorator: Dynamic Type Selection"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
     </div>
     <div class="footer">
       &copy; Copyright 2008, Creative Commons Attribution-Share Alike 3.0.
-      Last updated on Feb 13, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
+      Last updated on Apr 07, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
     </div>
   </body>
 </html>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
-  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     
     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
     <script type="text/javascript">
       var DOCUMENTATION_OPTIONS = {
-          URL_ROOT:    '',
-          VERSION:     '1.0',
-          COLLAPSE_MODINDEX: false,
-          FILE_SUFFIX: '.html'
+        URL_ROOT:    '',
+        VERSION:     '1.0',
+        COLLAPSE_MODINDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true
       };
     </script>
     <script type="text/javascript" src="_static/jquery.js"></script>
     <link rel="search" title="Search" href="search.html" />
     <link rel="top" title="Python 3 Patterns, Recipes and Idioms" href="index.html" />
     <link rel="next" title="Part II: Idioms" href="Part2.html" />
-    <link rel="prev" title="Metaclasses" href="Metaclasses.html" />
+    <link rel="prev" title="Metaclasses" href="Metaclasses.html" /> 
   </head>
   <body>
     <div class="related">
         <li class="right" >
           <a href="Metaclasses.html" title="Metaclasses"
              accesskey="P">previous</a> |</li>
-        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li>
+        <li><a href="index.html">Python 3 Patterns, Recipes and Idioms</a> &raquo;</li> 
       </ul>
-    </div>
+    </div>  
     <div class="document">
       <div class="documentwrapper">
         <div class="bodywrapper">
           <div class="body">
             
-