Commits

Anonymous committed 6b67f58

Added the beginning of the "Initialization and Cleanup" chapter.

Comments (0)

Files changed (64)

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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/AppFrameworks.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/CanonicalScript.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/ChangeInterface.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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 & Concurrency" href="CoroutinesAndConcurrency.html" />
-    <link rel="prev" title="Generators, Iterators, and Itertools" href="GeneratorsIterators.html" /> 
+    <link rel="next" title="Coroutines &amp; Concurrency" 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 & Concurrency"
+          <a href="CoroutinesAndConcurrency.html" title="Coroutines &amp; Concurrency"
              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-32"></span><h1>Comprehensions<a class="headerlink" href="#comprehensions" title="Permalink to this headline">¶</a></h1>
+<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>
 
 
             <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 &amp; Concurrency</a></p>
             <h3>This Page</h3>
             <ul class="this-page-menu">
-              <li><a href="_sources/Comprehensions.txt"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/Comprehensions.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 & Concurrency"
+          <a href="CoroutinesAndConcurrency.html" title="Coroutines &amp; Concurrency"
              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 Jan 23, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/Contributors.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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 & Concurrency &mdash; Python 3 Patterns, Recipes and Idioms</title>
+    <title>Coroutines &amp; Concurrency &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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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>
 <p>Primary focus should be on:</p>
 <div class="section" id="further-reading">
 <h2>Further Reading<a class="headerlink" href="#further-reading" title="Permalink to this headline">¶</a></h2>
 <blockquote>
-<a class="reference external" href="http://guidewiredevelopment.wordpress.com/2008/10/06/a-more-clearly-stated-version-of-my-argument/">This article</a>
+<p><a class="reference external" href="http://guidewiredevelopment.wordpress.com/2008/10/06/a-more-clearly-stated-version-of-my-argument/">This article</a>
 argues that large-scale parallelism &#8211; which is what
 <tt class="docutils literal"><span class="pre">multiprocessing</span></tt> supports &#8211; is the more important problem to solve, and
-that functional languages don&#8217;t help that much with this problem.</blockquote>
+that functional languages don&#8217;t help that much with this problem.</p>
+<p><a class="reference external" href="http://jessenoller.com/2009/02/01/python-threads-and-the-global-interpreter-lock/">http://jessenoller.com/2009/02/01/python-threads-and-the-global-interpreter-lock/</a></p>
+</blockquote>
 </div>
 </div>
 
 
 
             <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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/CoroutinesAndConcurrency.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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">
 <p>Tradeoff: coding is more complicated when using decorators</p>
 <div class="section" id="basic-decorator-structure">
 <h2>Basic Decorator Structure<a class="headerlink" href="#basic-decorator-structure" title="Permalink to this headline">¶</a></h2>
-<img alt="_images/decorator2.gif" src="_images/decorator2.gif" />
+<img alt="_images/decorator.gif" src="_images/decorator.gif" />
 </div>
 <div class="section" id="a-coffee-example">
 <h2>A Coffee Example<a class="headerlink" href="#a-coffee-example" title="Permalink to this headline">¶</a></h2>
 <p>One solution is to create an individual class for every combination. Each class
 describes the drink and is responsible for the cost etc. The resulting menu is
 huge, and a part of the class diagram would look something like this:</p>
-<img alt="_images/coffeeExplosion2.gif" src="_images/coffeeExplosion2.gif" />
+<img alt="_images/coffeeExplosion.gif" src="_images/coffeeExplosion.gif" />
 <p>The key to using this method is to find the particular combination you want.
 So, once you&#8217;ve found the drink you would like, here is how you would use it, as
 shown in the <strong>CoffeeShop</strong> class in the following code:</p>
 adds responsibility to a component by wrapping it, but the Decorator conforms to
 the interface of the component it encloses, so the wrapping is transparent.
 Decorators can also be nested without the loss of this transparency.</p>
-<img alt="_images/decoratedCoffee2.gif" src="_images/decoratedCoffee2.gif" />
+<img alt="_images/decoratedCoffee.gif" src="_images/decoratedCoffee.gif" />
 <p>Methods invoked on the Decorator can in turn invoke methods in the component,
 and can of course perform processing before or after the invocation.</p>
 <p>So if we added <strong>getTotalCost()</strong> and <strong>getDescription()</strong> methods to the
 they are, but if you wanted to decorate them (whipped cream, decaf etc.) then
 you would use decorators to make the modifications. This is the type of menu you
 are presented with in most coffee shops.</p>
-<img alt="_images/compromiseDecoration2.gif" src="_images/compromiseDecoration2.gif" />
+<img alt="_images/compromiseDecoration.gif" src="_images/compromiseDecoration.gif" />
 <p>Here is how to create a basic selection, as well as a decorated selection:</p>
 <div class="highlight-python"><pre># Decorator/compromise/CoffeeShop.py
 # Coffee example with a compromise of basic
 
 
             <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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/Decorator.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 26, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/DeveloperGuide.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/Factory.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/Fronting.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/FunctionObjects.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/GeneratorsIterators.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    
+    <title>Initialization and Cleanup &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'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="shortcut icon" href="_static/favicon.ico"/>
+    <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" />
+  </head>
+  <body>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <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"
+             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>
+      </ul>
+    </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">
+<h2>Initialization<a class="headerlink" href="#initialization" title="Permalink to this headline">¶</a></h2>
+<div class="section" id="constructor-calls">
+<h3>Constructor Calls<a class="headerlink" href="#constructor-calls" title="Permalink to this headline">¶</a></h3>
+<p>Automatic base-class constructor calls.</p>
+<p>Calling the base-class constructor first, how to do it using super(), why you
+should always call it first even if it&#8217;s optional when to call it.</p>
+</div>
+<div class="section" id="new-vs-init">
+<h3><strong>__new__()</strong> vs. <strong>__init__()</strong><a class="headerlink" href="#new-vs-init" title="Permalink to this headline">¶</a></h3>
+</div>
+<div class="section" id="static-fields">
+<h3>Static Fields<a class="headerlink" href="#static-fields" title="Permalink to this headline">¶</a></h3>
+<p>An excellent example of the subtleties of initialization is static fields
+in classes.</p>
+<dl class="docutils">
+<dt>::</dt>
+<dd><div class="first last highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">Foo</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
+<span class="gp">... </span>  <span class="n">x</span> <span class="o">=</span> <span class="s">&quot;a&quot;</span>
+<span class="gp">...</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Foo</span><span class="o">.</span><span class="n">x</span>
+<span class="go">&#39;a&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span> <span class="o">=</span> <span class="n">Foo</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="o">.</span><span class="n">x</span>
+<span class="go">&#39;a&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f2</span> <span class="o">=</span> <span class="n">Foo</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f2</span><span class="o">.</span><span class="n">x</span>
+<span class="go">&#39;a&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f2</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="s">&#39;b&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="o">.</span><span class="n">x</span>
+<span class="go">&#39;a&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Foo</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="s">&#39;c&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="o">.</span><span class="n">x</span>
+<span class="go">&#39;c&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f2</span><span class="o">.</span><span class="n">x</span>
+<span class="go">&#39;b&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Foo</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="s">&#39;d&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f2</span><span class="o">.</span><span class="n">x</span>
+<span class="go">&#39;b&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f</span><span class="o">.</span><span class="n">x</span>
+<span class="go">&#39;d&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f3</span> <span class="o">=</span> <span class="n">Foo</span><span class="p">()</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f3</span><span class="o">.</span><span class="n">x</span>
+<span class="go">&#39;d&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">Foo</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="s">&#39;e&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f3</span><span class="o">.</span><span class="n">x</span>
+<span class="go">&#39;e&#39;</span>
+<span class="gp">&gt;&gt;&gt; </span><span class="n">f2</span><span class="o">.</span><span class="n">x</span>
+<span class="go">&#39;b&#39;</span>
+</pre></div>
+</div>
+</dd>
+</dl>
+<p>If you assign, you get a new one. If it&#8217;s modifiable, then unless you
+assign you are working on a singleton. So a typical pattern is:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">Foo</span><span class="p">:</span>
+    <span class="n">something</span> <span class="o">=</span> <span class="bp">None</span> <span class="c"># Static: visible to all classes</span>
+    <span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">):</span>
+        <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">something</span><span class="p">:</span>
+            <span class="bp">self</span><span class="o">.</span><span class="n">something</span> <span class="o">=</span> <span class="p">[]</span> <span class="c"># New local version for this object</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">something</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>This is not a serious example because you would naturally just
+initialize <tt class="docutils literal"><span class="pre">something</span></tt> in <tt class="docutils literal"><span class="pre">Foo</span></tt>&#8216;s constructor.</p>
+</div>
+</div>
+<div class="section" id="cleanup">
+<h2>Cleanup<a class="headerlink" href="#cleanup" title="Permalink to this headline">¶</a></h2>
+<p>Cleanup happens to globals by setting them to <tt class="xref docutils literal"><span class="pre">None</span></tt> (what about locals?).
+Does the act of setting them to None cause __del__ to be called, or is
+__del__ called by Python before a global is set to None?</p>
+<p>Consider the following:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">Counter</span><span class="p">:</span>
+    <span class="n">Count</span> <span class="o">=</span> <span class="mf">0</span>   <span class="c"># This represents the count of objects of this class</span>
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+        <span class="k">print</span> <span class="n">name</span><span class="p">,</span> <span class="s">&#39;created&#39;</span>
+        <span class="n">Counter</span><span class="o">.</span><span class="n">Count</span> <span class="o">+=</span> <span class="mf">1</span>
+    <span class="k">def</span> <span class="nf">__del__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">print</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="s">&#39;deleted&#39;</span>
+        <span class="n">Counter</span><span class="o">.</span><span class="n">Count</span> <span class="o">-=</span> <span class="mf">1</span>
+        <span class="k">if</span> <span class="n">Counter</span><span class="o">.</span><span class="n">Count</span> <span class="o">==</span> <span class="mf">0</span><span class="p">:</span>
+            <span class="k">print</span> <span class="s">&#39;Last Counter object deleted&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">print</span> <span class="n">Counter</span><span class="o">.</span><span class="n">Count</span><span class="p">,</span> <span class="s">&#39;Counter objects remaining&#39;</span>
+
+<span class="n">x</span> <span class="o">=</span> <span class="n">Counter</span><span class="p">(</span><span class="s">&quot;First&quot;</span><span class="p">)</span>
+<span class="k">del</span> <span class="n">x</span>
+</pre></div>
+</div>
+<p>Without the final del, you get an exception. Shouldn&#8217;t the normal cleanup
+process take care of this?</p>
+<p>From the Python docs regarding <strong>__del__</strong>:</p>
+<blockquote>
+Warning: Due to the precarious circumstances under which __del__()
+methods are invoked, exceptions that occur during their execution are
+ignored, and a warning is printed to sys.stderr instead. Also, when
+__del__() is invoked in response to a module being deleted (e.g., when
+execution of the program is done), <em>other globals referenced by the
+__del__() method may already have been deleted</em>. For this reason,
+__del__() methods should do the absolute minimum needed to maintain
+external invariants.</blockquote>
+<p>Without the explicit call to <tt class="docutils literal"><span class="pre">del</span></tt>, <tt class="docutils literal"><span class="pre">__del__</span></tt> is only called at the end
+of the program, Counter and/or Count may have already been GC-ed by the
+time <tt class="docutils literal"><span class="pre">__del__</span></tt> is called (the order in which objects are collected is not
+deterministic). The exception means that Counter has already been collectd.
+You can&#8217;t do anything particularly fancy with __del__.</p>
+<p>There are two possible solutions here.</p>
+<blockquote>
+<p>1. Use an explicit finalizer method, such as <tt class="docutils literal"><span class="pre">close()</span></tt> for file
+objects.</p>
+<ol class="arabic simple" start="2">
+<li>Use weak references.</li>
+</ol>
+</blockquote>
+<p>Here&#8217;s an example of weak references, using a WeakValueDictionary and the
+trick of mapping id(self) to self:</p>
+<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">weakref</span> <span class="kn">import</span> <span class="n">WeakValueDictionary</span>
+
+<span class="k">class</span> <span class="nc">Counter</span><span class="p">:</span>
+    <span class="n">_instances</span> <span class="o">=</span> <span class="n">WeakValueDictionary</span><span class="p">()</span>
+    <span class="nd">@property</span>
+    <span class="k">def</span> <span class="nf">Count</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_instances</span><span class="p">)</span>
+
+    <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">):</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="n">name</span>
+        <span class="bp">self</span><span class="o">.</span><span class="n">_instances</span><span class="p">[</span><span class="nb">id</span><span class="p">(</span><span class="bp">self</span><span class="p">)]</span> <span class="o">=</span> <span class="bp">self</span>
+        <span class="k">print</span> <span class="n">name</span><span class="p">,</span> <span class="s">&#39;created&#39;</span>
+
+    <span class="k">def</span> <span class="nf">__del__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
+        <span class="k">print</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="s">&#39;deleted&#39;</span>
+        <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">Count</span> <span class="o">==</span> <span class="mf">0</span><span class="p">:</span>
+            <span class="k">print</span> <span class="s">&#39;Last Counter object deleted&#39;</span>
+        <span class="k">else</span><span class="p">:</span>
+            <span class="k">print</span> <span class="bp">self</span><span class="o">.</span><span class="n">Count</span><span class="p">,</span> <span class="s">&#39;Counter objects remaining&#39;</span>
+
+<span class="n">x</span> <span class="o">=</span> <span class="n">Counter</span><span class="p">(</span><span class="s">&quot;First&quot;</span><span class="p">)</span>
+</pre></div>
+</div>
+<p>Now cleanup happens properly without the need for an explicit call to
+<tt class="docutils literal"><span class="pre">del</span></tt>.</p>
+</div>
+<div class="section" id="further-reading">
+<h2>Further Reading<a class="headerlink" href="#further-reading" title="Permalink to this headline">¶</a></h2>
+</div>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar">
+        <div class="sphinxsidebarwrapper">
+            <p class="logo"><a href="index.html">
+              <img class="logo" src="_static/cover.png" alt="Logo"/>
+            </a></p>
+    <font color="Red">This book is in early development; you will find parts that are incorrect &amp; incomplete.</font>
+    
+            <h3><a href="index.html">Table Of Contents</a></h3>
+            <ul>
+<li><a class="reference external" href="">Initialization and Cleanup</a><ul>
+<li><a class="reference external" href="#initialization">Initialization</a><ul>
+<li><a class="reference external" href="#constructor-calls">Constructor Calls</a></li>
+<li><a class="reference external" href="#new-vs-init"><strong>__new__()</strong> vs. <strong>__init__()</strong></a></li>
+<li><a class="reference external" href="#static-fields">Static Fields</a></li>
+</ul>
+</li>
+<li><a class="reference external" href="#cleanup">Cleanup</a></li>
+<li><a class="reference external" href="#further-reading">Further Reading</a></li>
+</ul>
+</li>
+</ul>
+
+
+            <h4>Previous topic</h4>
+            <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>
+            <h3>This Page</h3>
+            <ul class="this-page-menu">
+              <li><a href="_sources/InitializationAndCleanup.txt">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>
+    <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>
+
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <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"
+             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>
+      </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.
+    </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/Introduction.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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',
-        HAS_SOURCE:  true
+          URL_ROOT:    '',
+          VERSION:     '1.0',
+          COLLAPSE_MODINDEX: false,
+          FILE_SUFFIX: '.html'
       };
     </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"
-                     rel="nofollow">Show Source</a></li>
+              <li><a href="_sources/Iterators.txt">Show Source</a></li>
             </ul>
     
-	  <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>
+          <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>
     <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 Jan 22, 2009.
-      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.
+      Last updated on Feb 13, 2009.
+      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.5.
     </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:    '',