BruceEckel / Python 3 Patterns & Idioms (http://mindviewinc.com/Books/Python3Patterns/Index.php)
An open source book written and edited by Bruce Eckel with contributions and help from the Python community. Published under the Creative Commons Attribution-Share Alike 3.0 license. To download the current version of the HTML book and example code, click the "download" link you'll see in the upper right. This includes the sources for building the book.
$ hg clone http://bitbucket.org/BruceEckel/python-3-patterns-idioms
| commit 55: | bf3127740601 |
| parent 54: | db760779bd06 |
| branch: | default |
Changed (Δ37.3 KB):
code/Metaclasses/SingletonDecorator.py (64 lines added, 0 lines removed)
html/Decorator.html (19 lines added, 5 lines removed)
html/Metaclasses.html (72 lines added, 2 lines removed)
html/PatternConcept.html (8 lines added, 1 lines removed)
html/QuickPython.html (24 lines added, 1 lines removed)
html/ToDo.html (1 lines added, 1 lines removed)
html/_images/coffeeExplosion1.gif (binary file changed)
html/_images/compromiseDecoration1.gif (binary file changed)
html/_images/decoratedCoffee1.gif (binary file changed)
html/_images/decorator1.gif (binary file changed)
html/_sources/Decorator.txt (8 lines added, 0 lines removed)
html/_sources/Metaclasses.txt (70 lines added, 1 lines removed)
html/_sources/PatternConcept.txt (6 lines added, 0 lines removed)
html/_sources/QuickPython.txt (20 lines added, 1 lines removed)
html/genindex.html (3 lines added, 3 lines removed)
html/index.html (5 lines added, 1 lines removed)
html/search.html (1 lines added, 1 lines removed)
html/searchindex.js (1 lines added, 1 lines removed)
src/Decorator.rst (8 lines added, 0 lines removed)
src/Metaclasses.rst (70 lines added, 1 lines removed)
src/PatternConcept.rst (6 lines added, 0 lines removed)
src/QuickPython.rst (6 lines added, 0 lines removed)
Up to file-list code/Metaclasses/SingletonDecorator.py:
1 |
# Metaclasses/SingletonDecorator.py |
|
2 |
||
3 |
def singleton(klass): |
|
4 |
"Simple replacement of object creation operation" |
|
5 |
def getinstance(*args, **kw): |
|
6 |
if not hasattr(klass, 'instance'): |
|
7 |
klass.instance = klass(*args, **kw) |
|
8 |
return klass.instance |
|
9 |
return getinstance |
|
10 |
||
11 |
def singleton(klass): |
|
12 |
""" |
|
13 |
More powerful approach: Change the behavior |
|
14 |
of the instances AND the class object. |
|
15 |
""" |
|
16 |
class Decorated(klass): |
|
17 |
def __init__(self, *args, **kwargs): |
|
18 |
if hasattr(klass, '__init__'): |
|
19 |
klass.__init__(self, *args, **kwargs) |
|
20 |
def __repr__(self) : return klass.__name__ + " obj" |
|
21 |
__str__ = __repr__ |
|
22 |
Decorated.__name__ = klass.__name__ |
|
23 |
class ClassObject: |
|
24 |
def __init__(cls): |
|
25 |
cls.instance = None |
|
26 |
def __repr__(cls): |
|
27 |
return klass.__name__ |
|
28 |
__str__ = __repr__ |
|
29 |
def __call__(cls, *args, **kwargs): |
|
30 |
print str(cls) + " __call__ " |
|
31 |
if not cls.instance: |
|
32 |
cls.instance = Decorated(*args, **kwargs) |
|
33 |
return cls.instance |
|
34 |
return ClassObject() |
|
35 |
||
36 |
@singleton |
|
37 |
class ASingleton: pass |
|
38 |
||
39 |
a = ASingleton() |
|
40 |
b = ASingleton() |
|
41 |
print(a, b) |
|
42 |
print a.__class__.__name__ |
|
43 |
print ASingleton |
|
44 |
assert a is b |
|
45 |
||
46 |
@singleton |
|
47 |
class BSingleton: |
|
48 |
def __init__(self, x): |
|
49 |
self.x = x |
|
50 |
||
51 |
c = BSingleton(11) |
|
52 |
d = BSingleton(22) |
|
53 |
assert c is d |
|
54 |
assert c is not a |
|
55 |
||
56 |
""" Output: |
|
57 |
ASingleton __call__ |
|
58 |
ASingleton __call__ |
|
59 |
(ASingleton obj, ASingleton obj) |
|
60 |
ASingleton |
|
61 |
ASingleton |
|
62 |
BSingleton __call__ |
|
63 |
BSingleton __call__ |
|
64 |
""" |
Up to file-list html/Decorator.html:
| … | … | @@ -64,7 +64,7 @@ interface</p> |
64 |
64 |
<p>Tradeoff: coding is more complicated when using decorators</p> |
65 |
65 |
<div class="section" id="basic-decorator-structure"> |
66 |
66 |
<h2>Basic Decorator Structure<a class="headerlink" href="#basic-decorator-structure" title="Permalink to this headline">¶</a></h2> |
67 |
<img alt="_images/decorator |
|
67 |
<img alt="_images/decorator1.gif" src="_images/decorator1.gif" /> |
|
68 |
68 |
</div> |
69 |
69 |
<div class="section" id="a-coffee-example"> |
70 |
70 |
<h2>A Coffee Example<a class="headerlink" href="#a-coffee-example" title="Permalink to this headline">¶</a></h2> |
| … | … | @@ -86,7 +86,7 @@ espresso; and three changes - decaf, ste |
86 |
86 |
<p>One solution is to create an individual class for every combination. Each class |
87 |
87 |
describes the drink and is responsible for the cost etc. The resulting menu is |
88 |
88 |
huge, and a part of the class diagram would look something like this:</p> |
89 |
<img alt="_images/coffeeExplosion |
|
89 |
<img alt="_images/coffeeExplosion1.gif" src="_images/coffeeExplosion1.gif" /> |
|
90 |
90 |
<p>The key to using this method is to find the particular combination you want. |
91 |
91 |
So, once you’ve found the drink you would like, here is how you would use it, as |
92 |
92 |
shown in the <strong>CoffeeShop</strong> class in the following code:</p> |
| … | … | @@ -170,7 +170,7 @@ components to describe a particular coff |
170 |
170 |
adds responsibility to a component by wrapping it, but the Decorator conforms to |
171 |
171 |
the interface of the component it encloses, so the wrapping is transparent. |
172 |
172 |
Decorators can also be nested without the loss of this transparency.</p> |
173 |
<img alt="_images/decoratedCoffee |
|
173 |
<img alt="_images/decoratedCoffee1.gif" src="_images/decoratedCoffee1.gif" /> |
|
174 |
174 |
<p>Methods invoked on the Decorator can in turn invoke methods in the component, |
175 |
175 |
and can of course perform processing before or after the invocation.</p> |
176 |
176 |
<p>So if we added <strong>getTotalCost()</strong> and <strong>getDescription()</strong> methods to the |
| … | … | @@ -275,7 +275,7 @@ reasonably sized menu of basic selection |
275 |
275 |
they are, but if you wanted to decorate them (whipped cream, decaf etc.) then |
276 |
276 |
you would use decorators to make the modifications. This is the type of menu you |
277 |
277 |
are presented with in most coffee shops.</p> |
278 |
<img alt="_images/compromiseDecoration |
|
278 |
<img alt="_images/compromiseDecoration1.gif" src="_images/compromiseDecoration1.gif" /> |
|
279 |
279 |
<p>Here is how to create a basic selection, as well as a decorated selection:</p> |
280 |
280 |
<div class="highlight-python"><pre># Decorator/compromise/CoffeeShop.py |
281 |
281 |
# Coffee example with a compromise of basic |
| … | … | @@ -365,6 +365,19 @@ the price of milk goes up? Having a clas |
365 |
365 |
need to change a method in each class, and thus maintain many classes. By using |
366 |
366 |
decorators, maintenance is reduced by defining the logic in one place.</p> |
367 |
367 |
</div> |
368 |
<div class="section" id="further-reading"> |
|
369 |
<h2>Further Reading<a class="headerlink" href="#further-reading" title="Permalink to this headline">¶</a></h2> |
|
370 |
<blockquote> |
|
371 |
<p>Philip Eby introduces decorators: <a class="reference external" href="http://www.ddj.com/web-development/184406073">http://www.ddj.com/web-development/184406073</a></p> |
|
372 |
<dl class="docutils"> |
|
373 |
<dt>Class Decorators:</dt> |
|
374 |
<dd><ul class="first last simple"> |
|
375 |
<li><a class="reference external" href="http://www.informit.com/articles/article.aspx?p=1309289&seqNum=4">http://www.informit.com/articles/article.aspx?p=1309289&seqNum=4</a></li> |
|
376 |
</ul> |
|
377 |
</dd> |
|
378 |
</dl> |
|
379 |
</blockquote> |
|
380 |
</div> |
|
368 |
381 |
<div class="section" id="exercises"> |
369 |
382 |
<h2>Exercises<a class="headerlink" href="#exercises" title="Permalink to this headline">¶</a></h2> |
370 |
383 |
<ol class="arabic simple"> |
| … | … | @@ -402,6 +415,7 @@ Olives.</li> |
402 |
415 |
<li><a class="reference external" href="#the-decorator-approach">The Decorator Approach</a></li> |
403 |
416 |
<li><a class="reference external" href="#compromise">Compromise</a></li> |
404 |
417 |
<li><a class="reference external" href="#other-considerations">Other Considerations</a></li> |
418 |
<li><a class="reference external" href="#further-reading">Further Reading</a></li> |
|
405 |
419 |
<li><a class="reference external" href="#exercises">Exercises</a></li> |
406 |
420 |
</ul> |
407 |
421 |
</li> |
| … | … | @@ -456,7 +470,7 @@ Olives.</li> |
456 |
470 |
</div> |
457 |
471 |
<div class="footer"> |
458 |
472 |
© Copyright 2008, Creative Commons Attribution-Share Alike 3.0. |
459 |
Last updated on Jan 2 |
|
473 |
Last updated on Jan 24, 2009. |
|
460 |
474 |
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6. |
461 |
475 |
</div> |
462 |
476 |
</body> |
Up to file-list html/Metaclasses.html:
48 |
48 |
<div class="body"> |
49 |
49 |
|
50 |
50 |
<div class="section" id="metaclasses"> |
51 |
<span id="index-4 |
|
51 |
<span id="index-42"></span><h1>Metaclasses<a class="headerlink" href="#metaclasses" title="Permalink to this headline">¶</a></h1> |
|
52 |
52 |
<div class="admonition note"> |
53 |
53 |
<p class="first admonition-title">Note</p> |
54 |
54 |
<p class="last">This chapter is written using Python 2.6 syntax; it will be |
| … | … | @@ -637,6 +637,75 @@ version. Because of this behavior, each |
637 |
637 |
class-specific <tt class="docutils literal"><span class="pre">instance</span></tt> field (thus <tt class="docutils literal"><span class="pre">instance</span></tt> is not somehow |
638 |
638 |
being “inherited” from the metaclass).</p> |
639 |
639 |
</div> |
640 |
<div class="section" id="a-class-decorator-singleton"> |
|
641 |
<h3>A Class Decorator Singleton<a class="headerlink" href="#a-class-decorator-singleton" title="Permalink to this headline">¶</a></h3> |
|
642 |
<div class="highlight-python"><div class="highlight"><pre><span class="c"># Metaclasses/SingletonDecorator.py</span> |
|
643 |
||
644 |
<span class="k">def</span> <span class="nf">singleton</span><span class="p">(</span><span class="n">klass</span><span class="p">):</span> |
|
645 |
<span class="s">"Simple replacement of object creation operation"</span> |
|
646 |
<span class="k">def</span> <span class="nf">getinstance</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kw</span><span class="p">):</span> |
|
647 |
<span class="k">if</span> <span class="ow">not</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">klass</span><span class="p">,</span> <span class="s">'instance'</span><span class="p">):</span> |
|
648 |
<span class="n">klass</span><span class="o">.</span><span class="n">instance</span> <span class="o">=</span> <span class="n">klass</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kw</span><span class="p">)</span> |
|
649 |
<span class="k">return</span> <span class="n">klass</span><span class="o">.</span><span class="n">instance</span> |
|
650 |
<span class="k">return</span> <span class="n">getinstance</span> |
|
651 |
||
652 |
<span class="k">def</span> <span class="nf">singleton</span><span class="p">(</span><span class="n">klass</span><span class="p">):</span> |
|
653 |
<span class="sd">"""</span> |
|
654 |
<span class="sd"> More powerful approach: Change the behavior</span> |
|
655 |
<span class="sd"> of the instances AND the class object.</span> |
|
656 |
<span class="sd"> """</span> |
|
657 |
<span class="k">class</span> <span class="nc">Decorated</span><span class="p">(</span><span class="n">klass</span><span class="p">):</span> |
|
658 |
<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="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> |
|
659 |
<span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">klass</span><span class="p">,</span> <span class="s">'__init__'</span><span class="p">):</span> |
|
660 |
<span class="n">klass</span><span class="o">.</span><span class="n">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> |
|
661 |
<span class="k">def</span> <span class="nf">__repr__</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="p">:</span> <span class="k">return</span> <span class="n">klass</span><span class="o">.</span><span class="n">__name__</span> <span class="o">+</span> <span class="s">" obj"</span> |
|
662 |
<span class="n">__str__</span> <span class="o">=</span> <span class="n">__repr__</span> |
|
663 |
<span class="n">Decorated</span><span class="o">.</span><span class="n">__name__</span> <span class="o">=</span> <span class="n">klass</span><span class="o">.</span><span class="n">__name__</span> |
|
664 |
<span class="k">class</span> <span class="nc">ClassObject</span><span class="p">:</span> |
|
665 |
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="n">cls</span><span class="p">):</span> |
|
666 |
<span class="n">cls</span><span class="o">.</span><span class="n">instance</span> <span class="o">=</span> <span class="bp">None</span> |
|
667 |
<span class="k">def</span> <span class="nf">__repr__</span><span class="p">(</span><span class="n">cls</span><span class="p">):</span> |
|
668 |
<span class="k">return</span> <span class="n">klass</span><span class="o">.</span><span class="n">__name__</span> |
|
669 |
<span class="n">__str__</span> <span class="o">=</span> <span class="n">__repr__</span> |
|
670 |
<span class="k">def</span> <span class="nf">__call__</span><span class="p">(</span><span class="n">cls</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> |
|
671 |
<span class="k">print</span> <span class="nb">str</span><span class="p">(</span><span class="n">cls</span><span class="p">)</span> <span class="o">+</span> <span class="s">" __call__ "</span> |
|
672 |
<span class="k">if</span> <span class="ow">not</span> <span class="n">cls</span><span class="o">.</span><span class="n">instance</span><span class="p">:</span> |
|
673 |
<span class="n">cls</span><span class="o">.</span><span class="n">instance</span> <span class="o">=</span> <span class="n">Decorated</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> |
|
674 |
<span class="k">return</span> <span class="n">cls</span><span class="o">.</span><span class="n">instance</span> |
|
675 |
<span class="k">return</span> <span class="n">ClassObject</span><span class="p">()</span> |
|
676 |
||
677 |
<span class="nd">@singleton</span> |
|
678 |
<span class="k">class</span> <span class="nc">ASingleton</span><span class="p">:</span> <span class="k">pass</span> |
|
679 |
||
680 |
<span class="n">a</span> <span class="o">=</span> <span class="n">ASingleton</span><span class="p">()</span> |
|
681 |
<span class="n">b</span> <span class="o">=</span> <span class="n">ASingleton</span><span class="p">()</span> |
|
682 |
<span class="k">print</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span> |
|
683 |
<span class="k">print</span> <span class="n">a</span><span class="o">.</span><span class="n">__class__</span><span class="o">.</span><span class="n">__name__</span> |
|
684 |
<span class="k">print</span> <span class="n">ASingleton</span> |
|
685 |
<span class="k">assert</span> <span class="n">a</span> <span class="ow">is</span> <span class="n">b</span> |
|
686 |
||
687 |
<span class="nd">@singleton</span> |
|
688 |
<span class="k">class</span> <span class="nc">BSingleton</span><span class="p">:</span> |
|
689 |
<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">x</span><span class="p">):</span> |
|
690 |
<span class="bp">self</span><span class="o">.</span><span class="n">x</span> <span class="o">=</span> <span class="n">x</span> |
|
691 |
||
692 |
<span class="n">c</span> <span class="o">=</span> <span class="n">BSingleton</span><span class="p">(</span><span class="mf">11</span><span class="p">)</span> |
|
693 |
<span class="n">d</span> <span class="o">=</span> <span class="n">BSingleton</span><span class="p">(</span><span class="mf">22</span><span class="p">)</span> |
|
694 |
<span class="k">assert</span> <span class="n">c</span> <span class="ow">is</span> <span class="n">d</span> |
|
695 |
<span class="k">assert</span> <span class="n">c</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">a</span> |
|
696 |
||
697 |
<span class="sd">""" Output:</span> |
|
698 |
<span class="sd">ASingleton __call__</span> |
|
699 |
<span class="sd">ASingleton __call__</span> |
|
700 |
<span class="sd">(ASingleton obj, ASingleton obj)</span> |
|
701 |
<span class="sd">ASingleton</span> |
|
702 |
<span class="sd">ASingleton</span> |
|
703 |
<span class="sd">BSingleton __call__</span> |
|
704 |
<span class="sd">BSingleton __call__</span> |
|
705 |
<span class="sd">"""</span> |
|
706 |
</pre></div> |
|
707 |
</div> |
|
708 |
</div> |
|
640 |
709 |
</div> |
641 |
710 |
<div class="section" id="metaclass-conflicts"> |
642 |
711 |
<h2>Metaclass Conflicts<a class="headerlink" href="#metaclass-conflicts" title="Permalink to this headline">¶</a></h2> |
| … | … | @@ -719,6 +788,7 @@ and edited and so tends to be more autho |
719 |
788 |
<li><a class="reference external" href="#using-init-vs-new-in-metaclasses">Using <tt class="docutils literal"><span class="pre">__init__</span></tt> vs. <tt class="docutils literal"><span class="pre">__new__</span></tt> in Metaclasses</a></li> |
720 |
789 |
<li><a class="reference external" href="#class-methods-and-metamethods">Class Methods and Metamethods</a><ul> |
721 |
790 |
<li><a class="reference external" href="#intercepting-class-creation">Intercepting Class Creation</a></li> |
791 |
<li><a class="reference external" href="#a-class-decorator-singleton">A Class Decorator Singleton</a></li> |
|
722 |
792 |
</ul> |
723 |
793 |
</li> |
724 |
794 |
<li><a class="reference external" href="#metaclass-conflicts">Metaclass Conflicts</a></li> |
| … | … | @@ -776,7 +846,7 @@ and edited and so tends to be more autho |
776 |
846 |
</div> |
777 |
847 |
<div class="footer"> |
778 |
848 |
© Copyright 2008, Creative Commons Attribution-Share Alike 3.0. |
779 |
Last updated on Jan 2 |
|
849 |
Last updated on Jan 24, 2009. |
|
780 |
850 |
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6. |
781 |
851 |
</div> |
782 |
852 |
</body> |
Up to file-list html/PatternConcept.html:
| … | … | @@ -289,6 +289,12 @@ intent for the same reason.</li> |
289 |
289 |
handful of fundamental ideas that can be held in your head while you analyze a |
290 |
290 |
problem. However, other ideas that come from this list may end up being useful |
291 |
291 |
as a checklist while walking through and analyzing your design.</p> |
292 |
</div> |
|
293 |
<div class="section" id="further-reading"> |
|
294 |
<h2>Further Reading<a class="headerlink" href="#further-reading" title="Permalink to this headline">¶</a></h2> |
|
295 |
<blockquote> |
|
296 |
Alex Martelli’s Video Lectures on Design Patterns in Python: |
|
297 |
<a class="reference external" href="http://www.catonmat.net/blog/learning-python-design-patterns-through-video-lectures/">http://www.catonmat.net/blog/learning-python-design-patterns-through-video-lectures/</a></blockquote> |
|
292 |
298 |
<p class="rubric">Footnotes</p> |
293 |
299 |
<table class="docutils footnote" frame="void" id="id7" rules="none"> |
294 |
300 |
<colgroup><col class="label" /><col /></colgroup> |
| … | … | @@ -351,6 +357,7 @@ when there’s nothing left to add, |
351 |
357 |
<li><a class="reference external" href="#pattern-taxonomy">Pattern Taxonomy</a></li> |
352 |
358 |
<li><a class="reference external" href="#design-structures">Design Structures</a></li> |
353 |
359 |
<li><a class="reference external" href="#design-principles">Design Principles</a></li> |
360 |
<li><a class="reference external" href="#further-reading">Further Reading</a></li> |
|
354 |
361 |
</ul> |
355 |
362 |
</li> |
356 |
363 |
</ul> |
| … | … | @@ -404,7 +411,7 @@ when there’s nothing left to add, |
404 |
411 |
</div> |
405 |
412 |
<div class="footer"> |
406 |
413 |
© Copyright 2008, Creative Commons Attribution-Share Alike 3.0. |
407 |
Last updated on Jan 2 |
|
414 |
Last updated on Jan 24, 2009. |
|
408 |
415 |
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6. |
409 |
416 |
</div> |
410 |
417 |
</body> |
Up to file-list html/QuickPython.html:
| … | … | @@ -469,6 +469,22 @@ initialize <tt class="docutils literal"> |
469 |
469 |
</pre></div> |
470 |
470 |
</div> |
471 |
471 |
</li> |
472 |
<li><p class="first">You can compose classes using <tt class="docutils literal"><span class="pre">import</span></tt>. Here’s a method that can |
|
473 |
be reused by multiple classes:</p> |
|
474 |
<blockquote> |
|
475 |
<p># QuickPython/utility.py |
|
476 |
def f(self): print “utility.f()!!!”</p> |
|
477 |
</blockquote> |
|
478 |
<p>Here’s how you compose that method into a class:</p> |
|
479 |
<div class="highlight-python"><div class="highlight"><pre><span class="c"># QuickPython/compose.py</span> |
|
480 |
||
481 |
<span class="k">class</span> <span class="nc">Compose</span><span class="p">:</span> |
|
482 |
<span class="kn">from</span> <span class="nn">utility</span> <span class="kn">import</span> <span class="n">f</span> |
|
483 |
||
484 |
<span class="n">Compose</span><span class="p">()</span><span class="o">.</span><span class="n">f</span><span class="p">()</span> |
|
485 |
</pre></div> |
|
486 |
</div> |
|
487 |
</li> |
|
472 |
488 |
<li><p class="first">Basic functional programming with <tt class="docutils literal"><span class="pre">map()</span></tt> etc.</p> |
473 |
489 |
</li> |
474 |
490 |
</ul> |
| … | … | @@ -477,6 +493,12 @@ initialize <tt class="docutils literal"> |
477 |
493 |
<p class="last">Suggest Further Topics for inclusion in the introductory chapter</p> |
478 |
494 |
</div> |
479 |
495 |
</div> |
496 |
<div class="section" id="further-reading"> |
|
497 |
<h2>Further Reading<a class="headerlink" href="#further-reading" title="Permalink to this headline">¶</a></h2> |
|
498 |
<blockquote> |
|
499 |
Python Programming FAQ: |
|
500 |
<a class="reference external" href="http://www.python.org/doc/faq/programming/">http://www.python.org/doc/faq/programming/</a></blockquote> |
|
501 |
</div> |
|
480 |
502 |
</div> |
481 |
503 |
|
482 |
504 |
|
| … | … | @@ -504,6 +526,7 @@ initialize <tt class="docutils literal"> |
504 |
526 |
</ul> |
505 |
527 |
</li> |
506 |
528 |
<li><a class="reference external" href="#useful-techniques">Useful Techniques</a></li> |
529 |
<li><a class="reference external" href="#further-reading">Further Reading</a></li> |
|
507 |
530 |
</ul> |
508 |
531 |
</li> |
509 |
532 |
</ul> |
| … | … | @@ -557,7 +580,7 @@ initialize <tt class="docutils literal"> |
557 |
580 |
</div> |
558 |
581 |
<div class="footer"> |
559 |
582 |
© Copyright 2008, Creative Commons Attribution-Share Alike 3.0. |
560 |
Last updated on Jan 2 |
|
583 |
Last updated on Jan 24, 2009. |
|
561 |
584 |
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6. |
562 |
585 |
</div> |
563 |
586 |
</body> |
Up to file-list html/ToDo.html:
| … | … | @@ -189,7 +189,7 @@ choose different name.</p> |
189 |
189 |
</div> |
190 |
190 |
<div class="footer"> |
191 |
191 |
© Copyright 2008, Creative Commons Attribution-Share Alike 3.0. |
192 |
Last updated on Jan 2 |
|
192 |
Last updated on Jan 24, 2009. |
|
193 |
193 |
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6. |
194 |
194 |
</div> |
195 |
195 |
</body> |
Up to file-list html/_images/coffeeExplosion1.gif:
Up to file-list html/_images/compromiseDecoration1.gif:
Up to file-list html/_images/decoratedCoffee1.gif:
Up to file-list html/_images/decorator1.gif:
Up to file-list html/_sources/Decorator.txt:
| … | … | @@ -354,6 +354,14 @@ the price of milk goes up? Having a clas |
354 |
354 |
need to change a method in each class, and thus maintain many classes. By using |
355 |
355 |
decorators, maintenance is reduced by defining the logic in one place. |
356 |
356 |
|
357 |
Further Reading |
|
358 |
======================================================================= |
|
359 |
||
360 |
Philip Eby introduces decorators: http://www.ddj.com/web-development/184406073 |
|
361 |
||
362 |
Class Decorators: |
|
363 |
- http://www.informit.com/articles/article.aspx?p=1309289&seqNum=4 |
|
364 |
||
357 |
365 |
Exercises |
358 |
366 |
======================================================================= |
359 |
367 |
Up to file-list html/_sources/Metaclasses.txt:
| … | … | @@ -627,7 +627,76 @@ version. Because of this behavior, each |
627 |
627 |
class-specific ``instance`` field (thus ``instance`` is not somehow |
628 |
628 |
being "inherited" from the metaclass). |
629 |
629 |
|
630 |
.. class decorator version that modifies __new__(). |
|
630 |
A Class Decorator Singleton |
|
631 |
-------------------------------------------------------------------------------- |
|
632 |
||
633 |
:: |
|
634 |
||
635 |
# Metaclasses/SingletonDecorator.py |
|
636 |
||
637 |
def singleton(klass): |
|
638 |
"Simple replacement of object creation operation" |
|
639 |
def getinstance(*args, **kw): |
|
640 |
if not hasattr(klass, 'instance'): |
|
641 |
klass.instance = klass(*args, **kw) |
|
642 |
return klass.instance |
|
643 |
return getinstance |
|
644 |
||
645 |
def singleton(klass): |
|
646 |
""" |
|
647 |
More powerful approach: Change the behavior |
|
648 |
of the instances AND the class object. |
|
649 |
""" |
|
650 |
class Decorated(klass): |
|
651 |
def __init__(self, *args, **kwargs): |
|
652 |
if hasattr(klass, '__init__'): |
|
653 |
klass.__init__(self, *args, **kwargs) |
|
654 |
def __repr__(self) : return klass.__name__ + " obj" |
|
655 |
__str__ = __repr__ |
|
656 |
Decorated.__name__ = klass.__name__ |
|
657 |
class ClassObject: |
|
658 |
def __init__(cls): |
|
659 |
cls.instance = None |
|
660 |
def __repr__(cls): |
|
661 |
return klass.__name__ |
|
662 |
__str__ = __repr__ |
|
663 |
def __call__(cls, *args, **kwargs): |
|
664 |
print str(cls) + " __call__ " |
|
665 |
if not cls.instance: |
|
666 |
cls.instance = Decorated(*args, **kwargs) |
|
667 |
return cls.instance |
|
668 |
return ClassObject() |
|
669 |
||
670 |
@singleton |
|
671 |
class ASingleton: pass |
|
672 |
||
673 |
a = ASingleton() |
|
674 |
b = ASingleton() |
|
675 |
print(a, b) |
|
676 |
print a.__class__.__name__ |
|
677 |
print ASingleton |
|
678 |
assert a is b |
|
679 |
||
680 |
@singleton |
|
681 |
class BSingleton: |
|
682 |
def __init__(self, x): |
|
683 |
self.x = x |
|
684 |
||
685 |
c = BSingleton(11) |
|
686 |
d = BSingleton(22) |
|
687 |
assert c is d |
|
688 |
assert c is not a |
|
689 |
||
690 |
""" Output: |
|
691 |
ASingleton __call__ |
|
692 |
ASingleton __call__ |
|
693 |
(ASingleton obj, ASingleton obj) |
|
694 |
ASingleton |
|
695 |
ASingleton |
|
696 |
BSingleton __call__ |
|
697 |
BSingleton __call__ |
|
698 |
""" |
|
699 |
||
631 |
700 |
|
632 |
701 |
Metaclass Conflicts |
633 |
702 |
================================================================================ |
Up to file-list html/_sources/PatternConcept.txt:
| … | … | @@ -257,6 +257,12 @@ handful of fundamental ideas that can be |
257 |
257 |
problem. However, other ideas that come from this list may end up being useful |
258 |
258 |
as a checklist while walking through and analyzing your design. |
259 |
259 |
|
260 |
Further Reading |
|
261 |
================================================================================== |
|
262 |
||
263 |
Alex Martelli's Video Lectures on Design Patterns in Python: |
|
264 |
http://www.catonmat.net/blog/learning-python-design-patterns-through-video-lectures/ |
|
265 |
||
260 |
266 |
.. rubric:: Footnotes |
261 |
267 |
|
262 |
268 |
.. [#] From Mark Johnson. |
Up to file-list html/_sources/QuickPython.txt:
| … | … | @@ -470,11 +470,30 @@ Useful Techniques |
470 |
470 |
f(*x) |
471 |
471 |
f(*(1,2,3)) |
472 |
472 |
|
473 |
- You can compose classes using ``import``. Here's a method that can |
|
474 |
be reused by multiple classes: |
|
475 |
||
476 |
# QuickPython/utility.py |
|
477 |
def f(self): print "utility.f()!!!" |
|
478 |
||
479 |
Here's how you compose that method into a class:: |
|
480 |
||
481 |
# QuickPython/compose.py |
|
482 |
||
483 |
class Compose: |
|
484 |
from utility import f |
|
485 |
||
486 |
Compose().f() |
|
487 |
||
473 |
488 |
- Basic functional programming with ``map()`` etc. |
474 |
489 |
|
475 |
490 |
|
476 |
491 |
.. note:: Suggest Further Topics for inclusion in the introductory chapter |
477 |
492 |
|
493 |
Further Reading |
|
494 |
=========================================================================== |
|
478 |
495 |
|
496 |
Python Programming FAQ: |
|
497 |
http://www.python.org/doc/faq/programming/ |
|
479 |
498 |
|
480 |
||
499 |
Up to file-list html/genindex.html:
62 |
62 |
<dd><dl> |
63 |
63 |
<dt><a href="CanonicalScript.html#index-0">script command-line</a></dt> |
64 |
64 |
</dl></dd> |
65 |
<dt><a href="Metaclasses.html#index-4 |
|
65 |
<dt><a href="Metaclasses.html#index-42">class decorators</a></dt> |
|
66 |
66 |
<dt>command-line</dt> |
67 |
67 |
<dd><dl> |
68 |
68 |
<dt><a href="CanonicalScript.html#index-0">canonical form, script</a></dt> |
123 |
123 |
<dl> |
124 |
124 |
|
125 |
125 |
<dt><a href="Messenger.html#index-10">messenger (data transfer object)</a></dt> |
126 |
<dt><a href="Metaclasses.html#index-4 |
|
126 |
<dt><a href="Metaclasses.html#index-42">Metaclasses</a></dt></dl></td><td width="33%" valign="top"><dl> |
|
127 |
127 |
<dt><a href="CoroutinesAndConcurrency.html#index-3">multiprocessing</a></dt> |
128 |
128 |
</dl></td></tr></table> |
129 |
129 |
|
202 |
202 |
</div> |
203 |
203 |
<div class="footer"> |
204 |
204 |
© Copyright 2008, Creative Commons Attribution-Share Alike 3.0. |
205 |
Last updated on Jan 2 |
|
205 |
Last updated on Jan 24, 2009. |
|
206 |
206 |
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6. |
207 |
207 |
</div> |
208 |
208 |
</body> |
Up to file-list html/index.html:
97 |
97 |
</ul> |
98 |
98 |
</li> |
99 |
99 |
<li class="toctree-l2"><a class="reference external" href="QuickPython.html#useful-techniques">Useful Techniques</a></li> |
100 |
<li class="toctree-l2"><a class="reference external" href="QuickPython.html#further-reading">Further Reading</a></li> |
|
100 |
101 |
</ul> |
101 |
102 |
</li> |
102 |
103 |
<li class="toctree-l1"><a class="reference external" href="UnitTesting.html">Unit Testing & Test-Driven Development</a><ul> |
150 |
151 |
<li class="toctree-l2"><a class="reference external" href="Metaclasses.html#using-init-vs-new-in-metaclasses">Using <tt class="docutils literal"><span class="pre">__init__</span></tt> vs. <tt class="docutils literal"><span class="pre">__new__</span></tt> in Metaclasses</a></li> |
151 |
152 |
<li class="toctree-l2"><a class="reference external" href="Metaclasses.html#class-methods-and-metamethods">Class Methods and Metamethods</a><ul> |
152 |
153 |
<li class="toctree-l3"><a class="reference external" href="Metaclasses.html#intercepting-class-creation">Intercepting Class Creation</a></li> |
154 |
<li class="toctree-l3"><a class="reference external" href="Metaclasses.html#a-class-decorator-singleton">A Class Decorator Singleton</a></li> |
|
153 |
155 |
</ul> |
154 |
156 |
</li> |
155 |
157 |
<li class="toctree-l2"><a class="reference external" href="Metaclasses.html#metaclass-conflicts">Metaclass Conflicts</a></li> |
199 |
201 |
<li class="toctree-l2"><a class="reference external" href="PatternConcept.html#pattern-taxonomy">Pattern Taxonomy</a></li> |
200 |
202 |
<li class="toctree-l2"><a class="reference external" href="PatternConcept.html#design-structures">Design Structures</a></li> |
201 |
203 |
<li class="toctree-l2"><a class="reference external" href="PatternConcept.html#design-principles">Design Principles</a></li> |
204 |
<li class="toctree-l2"><a class="reference external" href="PatternConcept.html#further-reading">Further Reading</a></li> |
|
202 |
205 |
</ul> |
203 |
206 |
</li> |
204 |
207 |
<li class="toctree-l1"><a class="reference external" href="Singleton.html">The Singleton</a><ul> |
237 |
240 |
<li class="toctree-l2"><a class="reference external" href="Decorator.html#the-decorator-approach">The Decorator Approach</a></li> |
238 |
241 |
<li class="toctree-l2"><a class="reference external" href="Decorator.html#compromise">Compromise</a></li> |
239 |
242 |
<li class="toctree-l2"><a class="reference external" href="Decorator.html#other-considerations">Other Considerations</a></li> |
243 |
<li class="toctree-l2"><a class="reference external" href="Decorator.html#further-reading">Further Reading</a></li> |
|
240 |
244 |
<li class="toctree-l2"><a class="reference external" href="Decorator.html#exercises">Exercises</a></li> |
241 |
245 |
</ul> |
242 |
246 |
</li> |
390 |
394 |
</div> |
391 |
395 |
<div class="footer"> |
392 |
396 |
© Copyright 2008, Creative Commons Attribution-Share Alike 3.0. |
393 |
Last updated on Jan 2 |
|
397 |
Last updated on Jan 24, 2009. |
|
394 |
398 |
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6. |
395 |
399 |
</div> |
396 |
400 |
</body> |
Up to file-list html/search.html:
96 |
96 |
|
97 |
97 |
<div class="footer"> |
98 |
98 |
© Copyright 2008, Creative Commons Attribution-Share Alike 3.0. |
99 |
Last updated on Jan 2 |
|
99 |
Last updated on Jan 24, 2009. |
|
100 |
100 |
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6. |
101 |
101 |
</div> |
102 |
102 |
<script type="text/javascript" src="searchindex.js"></script> |
Up to file-list html/searchindex.js:
1 |
Search.setIndex({desctypes:{},terms:{defaultcloseoper:10,orthogon:21,yellow:[ |
|
1 |
Search.setIndex({desctypes:{},terms:{defaultcloseoper:10,orthogon:21,yellow:[29,18],four:[13,36,12],secondli:20,prefix:29,sleep:[36,29],dirnam:[1,6],"00798f9c":22,browse_thread:7,gladiolu:32,evalscissor:23,whose:[16,28,11,23,29],authorit:18,typeerror:18,pprint:18,selen:7,concret:[28,1,4],swap:[35,29],under:[21,10,11,1,12,2,16,35,7],testabl:1,worth:[28,10,4,18],lure:12,everi:[21,33,10,1,12,2,4,16,28,29,8,20],risk:30,inventfeatur:32,matchobj:6,rise:21,lurk:10,voic:[2,13,1],decorator_without_argu:8,govern:12,affect:[28,29,18],vast:18,disturb:[28,4],nestedshapefactori:4,ref:7,decorator_with_argu:8,previou:[28,12,2,4,8,20],correct:[10,28,12],"__templatemethod":0,getdeclaredmethod:1,math:[10,28,29],verif:1,unpredictableperson:12,cappuccinowhip:20,c02:1,cmp:[18,12],storag:22,"10f":28,direct:[21,9,10,12,4,8,36],sourceforg:[10,29],nail:28,hors:33,classcastexcept:16,"__finditem__":10,even:[10,11,1,13,28,33,19,35,18,7,22,8,20],hide:[21,28,37],createshap:4,canvasheight:36,item1:23,weren:22,shallowai:11,firstdigit:12,"new":[0,1,2,3,4,6,7,14,10,11,12,13,15,16,18,20,21,23,28,32,33,36],net:[21,10,1,29,2,13,7],ever:[16,28,23],succumb:1,liberti:37,told:4,getsiz:29,widget:29,abov:[21,10,11,1,29,2,8,15,4,33,13,35,18,32,7,22,28,14,20],never:[2,28,10,22,1],here:[1,2,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,28,23,22,29,31,33,36,37],fun:[8,18],debugg:7,gridlayout:29,path:[28,1,12,10,6,7,29],cardboard:28,interpret:[21,9,10,11,28],dry:20,sweeet:7,haschang:[29,12],credit:[13,9],loop:[21,28,0,10,4,33],studi:[21,28,1,29,4,18],readlinesetup:10,portabl:[10,4],tremend:10,golden:21,propag:[21,28,29],"_test":6,brought:[7,33,10],substr:28,unix:31,ratsandmaz:36,wateron:[10,18],total:[10,28,12],unit:[9,10,1],getchar:10,plot:29,redon:13,describ:[21,33,10,1,12,2,32,28,16,35,5,18,7,20],would:[33,10,0,1,12,2,29,4,16,28,11,17,22,8,20],quickpython:33,call:[21,9,10,0,1,12,33,32,29,4,23,16,28,11,6,18,7,22,37,8,35],typo:13,recommend:28,type:[21,9,10,11,1,12,33,32,29,4,23,16,28,6,18,7,22,37,20],until:[21,10,11,12,32,28,33,6,19,8],looni:11,relat:[21,35],notic:[28,1,29,32,23,10,33,4,8],hurt:29,warn:[21,10,14,28],glass:28,"__iter__":18,loss:20,flowervisitor:32,moin:8,hole:1,hold:[10,11,12,13,28,16],unpack:[28,10,6],must:[10,11,1,12,2,32,29,4,23,33,28,5,36,18,7,22,37,8,20],join:[10,6,18],sometim:[21,10,0,37,13,28,18,7,8],err:[28,1],setup:[7,1,4],work:[21,9,10,28,1,29,33,2,8,4,23,16,13,35,6,18,7,22,14,20,19],worm:32,introduc:[21,10,1,2,28,13,18,20],root:[28,1],overrid:[28,0,1,12,33,18,7,29],walk_comprehens:10,give:[21,10,1,31,2,28,33,13,18,7,8,36],digit:12,indic:[9,10,30,12,28,4,33,29,8],setvis:[10,36,29],unavail:12,unassign:7,keep:[21,10,28,1,12,2,4,13,35,5,18,7,29],addtobin:28,end:[21,10,11,29,2,28,23,33,13,18,14,36],quot:33,ordinari:[28,1,29,10,4,18],classifi:[21,9],revisit:[28,4],how:[21,33,10,11,1,29,2,32,15,4,23,16,13,7,22,28,20],hot:20,disappear:[19,36],env:1,regist:[7,29],answer:[7,28,1,23],verifi:[10,1],changeinterfac:37,perspect:[21,28],"void":[10,1],updat:[30,29,6,7,14,36],my_new:22,recogn:[],lai:1,mess:2,coffeeshop:20,after:[21,10,11,1,12,8,28,33,36,18,7,22,14,20],implementation1:35,lump:35,implementation2:35,diagram:[9,28,12,13,35,7,14,20],befor:[21,33,10,11,1,12,2,28,16,18,29,8,20],wrong:[28,10,1],beauti:[28,35],law:21,parallel:[21,3],demonstr:[10,0,1,29,12,32,23,33,35],beanmeup:20,chere:7,profess:17,attempt:[21,28,1],third:28,classmethod:[22,18],revolv:21,exclud:1,wink:0,maintain:[21,28,11,12,13,23,36,8,20],environ:[7,32,28,4,31],incorpor:[10,11,8,1],enter:[10,8,29,12,36],lambda:[10,18],someplac:7,order:[33,10,0,29,12,2,4,16,28,11,5,18,7,14,20,35],origin:[10,1,29,14,28,16,36,8,20],composit:21,softwar:[7,1],over:[21,33,10,11,1,2,28,16,18,8],failur:[21,11,1],orang:29,becaus:[21,33,10,1,12,2,32,29,28,16,13,35,18,7,22,37,8,19],paperscissorsrock:[32,23],flexibl:[21,9,10,11,12,28,23,33,18,38,20],vari:[21,11],getinst:18,fit:[21,28,11,1,29,2,35],fix:[28,29,30,13,32,22,7,14,20],avocado:20,"__class__":[10,11,32,23,18,20],bytecod:10,better:[21,10,11,1,12,2,28,13,29,8],imp:[16,35],blemang:33,comprehens:[9,10,6,18],hidden:[33,28,0,35],schmidt:28,easier:[21,10,1,12,32,5,18,7,29,8],glassbin:28,them:[21,33,10,11,1,29,2,32,28,23,16,13,36,6,18,7,8,20,17],thei:[21,33,10,11,1,12,2,32,29,28,16,13,6,18,22,37,8,20],proce:7,safe:[16,9,10,8],stringformat:33,"break":[28,1,30,20,36,6],promis:28,setvalu:28,"instanceof":28,choic:[28,11,29,2,32,4,23,13,36,18,7,20],grammat:2,alex:[21,22],brough:[],getvalu:[10,28,12],closeobserv:29,each:[21,9,10,0,1,12,32,29,4,23,33,28,11,36,6,18,22,14,20,35],debug:[10,14,30],higher:7,side:[7,13,10,28,1],mean:[21,33,10,11,1,12,13,32,28,16,35,18,29,8,20],prohibit:28,setdefaultcloseoper:[10,29],nochang:12,enorm:8,arduou:20,taught:11,makecharact:4,receptacl:28,collector:10,whip:20,goe:[13,33,28,20],langug:10,gof:[21,11,35],classobject:18,content:28,rewrit:[10,2,8,28,16,13,35,37,7,14,20],dsl:10,vector:[21,28,36,12],adapt:[7,9,28,37],reader:[9,1,13,16,33,5,19],got:[13,1,37],washer:12,forth:10,dsc:18,linear:21,barrier:21,situat:[28,1,10,33,18,22],free:[7,13,21,12],standard:[21,10,11,1,29,33,8],ncpu:31,println:[28,10,1],mousemovegener:12,quickinstal:7,"__subclasses__":[32,4,23],kit:10,acrobat:7,uiuc:28,puzzl:4,angl:21,openssh:7,filter:18,mvc:29,isn:[21,10,0,29,2,28,33,35],subtl:[21,28],onto:21,bite:1,rang:[10,0,29,32,4,23,33],perfectli:12,gradi:28,setlayout:29,hoop:8,independ:[21,28,29,18],wast:[33,4,29],restrict:[2,10,8,22,29],"__tojava__":10,unlik:[33,28,11,1],alreadi:[21,10,11,1,29,2,28,16,18,7,36],messag:[21,10,12,1,29,33,7],wasn:28,getmemb:6,thick:4,agre:33,primari:[28,11,1,3,18,32],hood:10,brillig:10,vendingmachinetest:12,rewritten:[13,19],"__implement":35,spinach:20,top:20,evolut:[21,28],stack:29,rsrc:29,exponenti:[21,20],necessarili:[13,0],master:[10,28,12],too:[21,10,1,13,28,34,19,8,20],similarli:10,john:18,ndiff:6,consol:[10,1],namespac:18,tool:[9,10,11,1,12,2,4,13,7,29,28,14],lower:21,getcontentpan:29,somewhat:2,conserv:18,technic:13,trek:22,silli:28,target:[10,29],keyword:[33,29,10,4,18],provid:[21,33,10,0,1,12,29,4,16,28,11,37,7,22,8,20,35],"__onlyon":22,tree:[10,1],second:[33,10,11,29,28,23,16,35,22,8],"final":[21,9,10,0,1,29,2,32,28,13,36,18,7,8,20],project:[21,9,10,1,2,32,28,13,17,7,14,36],matter:[21,28,11,13,4,18],shapefactori:4,foamedmilk:20,fashion:[33,28,8],mind:[13,22,1,6],mine:7,raw:33,aforement:21,"__main__":[22,1,29,10,33,6,18],seen:[21,33,10,11,29,12,2,4,16,35,18,8],seem:[21,10,1,12,14,4,33,28,35,8],seek:[28,12],seminar:2,innerclass:10,realm:[16,21],respectjavaaccess:10,terrif:10,person:[7,10],latter:[21,10],especi:[21,28,30,10,33,17],thorough:10,alreadyopen:29,staticinnerclass:10,client:[28,0,1,12,2,35,37],alldecor:20,thoroughli:2,wherebi:12,simplifi:[7,22,10,4],shall:[10,11,1],bruce:7,glob:[10,1],object:[1,4,5,8,9,10,11,12,14,16,18,36,21,22,23,28,29,32,33,35,20,37],what:[1,2,3,4,6,7,8,9,10,11,12,13,16,18,19,20,21,28,22,29,33,35,37],messeng:[9,28,11,12,5,6],regular:[33,10,1,20],letter:0,phase:[21,28,8],coin:11,sub:6,tradit:21,simplic:[21,32,10,12,33],don:[21,9,10,28,37,29,2,3,4,23,33,13,34,35,18,7,8,19],simplif:[10,18],pythoninterpreterset:10,doc:[7,33],flow:[13,10],doe:[21,10,11,1,12,8,29,4,33,28,0,18,22,14,30,35],bash_profil:7,dummi:11,declar:[33,1,18],wildcard:10,itemslot:12,notion:35,dot:10,marvel:33,has_kei:[28,4,12,31],class_nam:18,endear:10,visitor:[21,9,28,1,29,32],"__str__":[22,11,12,32,23,18],random:[21,28,29,32,4,23],particip:7,syntax:[10,1,28,33,5,18,22,8],"2008v1":7,involv:[21,28,15,22,16,18,7],despit:28,layout:[2,13,10],acquir:29,field2:18,menu:[7,15,4,20],explain:[35,8,1,18,4],configur:[9,10,29,12,13,28,23,18,7,38],restaur:20,sugar:8,theme:11,busi:32,"__call__":[22,11,8,18],python3pattern:[7,14],oct:10,edict:32,cappuccino:20,vener:7,stop:[28,1],on_mouseup:29,report:[7,1,36],rosettacod:11,bat:10,bar:[13,3,22,18],isopen:29,emb:[33,10],baz:[3,18],choru:35,"public":[21,10,1,2,28,13],twice:[1,29],bad:[13,4],steam:20,black:[9,1,29],fair:11,decoratortalk:8,elimin:[10,28],mandatori:21,result:[21,33,10,11,1,29,28,16,6,18,8,20,36],respons:[9,28,0,12,33,11,36,20],fail:[28,10,8,1,12],hash:[16,33,12],charact:[10,4],hammer:28,best:[21,10,2,33,13,7,8],brazil:2,awar:[28,10,29,4,18],said:2,alsum:28,databas:22,hgrc:7,red3d:36,discoveri:[21,28],figur:[2,13,10,28,31],emptor:19,simplest:[21,22,10,1,29],awai:[21,28,20,12],getkei:10,approach:[21,9,10,29,12,32,4,16,28,18,7,22,37,8,20],attribut:[21,10,2,5,18,8],accord:[16,28,1],extend:[16,32,28,1,4],xrang:10,weak:33,extens:[7,13,10,28,18],lazi:[22,35,12],preprocessor:8,backgroundcolor:29,rtti:[9,28],aparat:28,protect:[10,35,1,29],accident:[21,28,18],expos:[28,37],howev:[21,33,10,11,1,12,13,32,29,4,16,28,35,5,36,18,7,22,37,8,20],pitt:8,against:[32,10,8,28],sketch:13,logic:[21,29,20],countri:11,com:[21,10,1,12,13,28,16,36,18,7,8,20],con:20,compromis:[9,20],kwd:22,notifyobserv:29,elf:32,trunk:[7,9,10],sai:[21,33,10,0,29,12,13,32,28,23,16,11,6,18,7,8],"2nd":10,diff:7,guid:[7,9],assum:[7,33,28,22],duplic:[21,6],light:[10,18],testsynchron:29,ianbick:18,three:[21,10,12,32,18,8,20],been:[21,10,29,12,2,28,33,13,35,18,19,22,8],chrysanthemum:32,much:[21,10,28,1,29,2,3,4,33,13,18,32,7,8,19],interest:[21,10,1,29,2,28,18,22,8],basic:[21,9,10,1,12,2,4,33,16,28,35,18,29,37,8,20],"__doc__":6,"__len__":10,quickli:[10,12],life:29,mcl:18,deeper:[28,10,4],spit:18,getval:10,xxx:31,isfunct:6,dave:16,alreadyclos:29,bookstor:2,ugli:[28,37],exception:[33,10],ident:[28,37,22,12],occam:21,gnu:1,servic:[2,13],properti:10,commerci:[13,10],air:[4,12],employ:2,calcul:[11,29],aid:33,vagu:21,dizzi:21,enlev:21,seconddigit:12,player:29,kwarg:[5,6,18],tediou:[10,29],sever:[28,10,4,12],valgen:10,quand:21,perform:[21,10,11,1,12,32,4,23,28,0,18,29,8,20],suggest:[21,28,1,13,22,33,7],make:[1,2,4,5,6,7,8,9,10,11,12,13,14,17,18,20,21,28,23,22,30,29,32,33,35],format:[2,7,33,13],who:[28,29,30,2,13,17,18,7,14],complex:[9,10,11,1,29,4,6,8],descend:1,complet:[21,10,1,12,28,35,7,29,8,36],inheritor:[29,18],blue:[29,18],listperform:38,hand:[21,33,28,11,29,13,4,16,18,22,8],fairli:[21,28,1,29,10,23,18],nix:10,rais:[2,28,18,12],garlic:20,refin:[10,14,28],techniqu:[9,28,3,4,16,33,6,32,22],qualif:10,jframe:[10,29],kept:[2,1],thu:[21,33,10,11,1,12,4,23,16,28,0,18,8,20],getbyt:36,pymeta3:18,inherit:[21,9,10,11,1,12,29,4,33,28,0,18,22,20],runtimeexcept:[16,12],academia:11,shortli:[33,1],greatest:[21,28],thi:[0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,18,19,20,21,22,23,28,29,30,32,33,34,35,36,37],programm:[21,9,10,0,1,12,2,22,33,35,37,8],everyth:[10,29,31,2,28,33,13,18,19,8],isomorph:21,left:[21,28,29,13,32,15,6,7],agon:2,identifi:[7,33,10,4],setcolor:[36,29],just:[1,2,4,5,6,7,8,10,11,12,13,18,19,20,21,28,23,22,29,31,33,35],"__dict__":[22,5,6,29],kdiff3:7,yet:[33,10,1,29,13,28,16,6,18,19,22,36],languag:[21,9,10,11,1,12,3,4,33,28,34,6,18,8,30],previous:[28,4,18],easi:[21,10,1,28,23,33,7,20],had:[21,33,10,11,1,12,2,32,28,16,36,8,20],keyset:[10,28],spread:[4,23],prison:36,falter:1,els:[21,10,1,12,31,28,33,6,7,22,36],functionobject:11,explanatori:10,gave:[2,28],applic:[21,9,10,0,12,4,35,7,8],fortun:28,larman:37,mayb:[13,14,1],metabas:18,background:29,elabor:28,shadow:21,unten:8,readlineconsol:10,apart:21,maxval:10,specif:[21,10,11,1,12,4,16,28,35,18,7,29,14],arbitrari:[33,28],nudg:0,hunt:[28,29,18,36],manual:[28,23],doubledispatch:28,singl:[10,11,29,12,13,4,23,33,28,35,7,22,8],night:[2,10,18],ocbox:29,unnecessari:[10,35,4,12],singletonpattern:22,underli:21,www:[21,33,10,11,1,12,28,16,36,18,7,29,8,20],right:[21,10,29,2,28,33,13,6,18,7,19],old:28,deal:[28,10,6,37,23],printf:33,interp:10,somehow:[10,35,28,18],percentag:2,intern:[16,28,1,4],create_exec:18,borg:22,"5b0":10,indirect:28,successfulli:[7,28,1],atteint:21,txt:[36,12],htmlhelp:7,bottom:[33,11],subclass:[9,10,12,4,28,18,20],suffici:10,condit:[9,11,1,12,4,33,36],foo:[10,13,3,22,33,18,8],paintcompon:29,sensibl:[4,18,23],steamedmilk:20,confer:[2,13,28],speak:[2,35],promot:[2,28],mazegen:36,pylist:10,post:[7,8],"super":[33,22,29,18],create_mc:18,meyer:36,trustworthi:6,unpackag:10,obj:[16,33,18],getparametertyp:1,slightli:[9,1,12,5,18,29,8],py2float:10,surround:[33,28,36,29],simul:[21,9,28],commit:[7,14],produc:[21,10,28,1,12,2,32,4,23,16,13,18,37,8],makeobstacl:4,dilemma:[32,28],thermostat:[10,18],javac:10,curiou:19,basenam:6,"float":10,encod:23,bound:[2,32,10,28],mocha:20,down:[10,11,1,29,4,36,20],creativ:[2,28,17],weightvisitor:28,coverag:[14,30,18],cappuccinodecafwhip:20,wrap:[10,11,29,28,16,22,8,20],opportun:28,clearchang:29,javax:10,testdumpclassinfo:10,east:36,accordingli:13,wai:[1,2,4,5,7,8,10,11,12,13,18,20,21,28,22,30,29,31,32,33,35,37],frustrat:10,support:[9,10,1,12,2,3,4,33,28,17,7,29],"class":[0,1,4,5,6,8,9,10,11,12,16,18,36,21,22,23,28,29,32,33,35,20,37,38],avail:[21,10,11,1,2,28,33,18],width:[36,29],reli:[16,28,5],editor:[7,13],analysi:21,head:[21,11],medium:21,repetiti:15,form:[21,9,28,1,29,2,15,4,16,33,18],offer:20,altogeth:[21,28],forg:1,heat:12,hear:1,dead:36,heap:[28,35],hashtabl:[],"true":[28,1,12,10,4,33,18],analyst:28,"6dd415847e5cbf7c":7,entryexit:8,pragu:28,setsuccess:11,maximum:[21,33],tell:[10,11,1,12,4,33,28,7,36],minor:29,absenc:1,fundament:[11,21,0,1,33],trim:28,developerwork:18,classif:21,featur:[21,10,1,2,15,28,33,34,7,8],setxi:36,semicolon:33,classic:[28,12],howdi:[10,18],request:[21,11,36,12],"abstract":[21,9,28,4,37],visitabledecor:28,drive:0,exist:[28,0,4,16,6,18],desir:[10,11,5,28,29],download:[2,7,10,16,29],mold:[28,37],check:[10,1,12,29,4,33,28,6,18,7,22,14],assembl:20,pipe:10,mindview:10,metamethod:[9,18],tip:7,refactor:[9,28,1,30],tij:38,test:[21,9,10,11,1,12,28,19,6,18,7,29,14],tie:21,presum:[28,4],smell:12,realiti:10,getsizetupl:29,notif:[21,29],intend:[2,10,1],felt:10,intent:[16,21,32],consid:[21,9,10,11,1,28,23,35,36,18,8,20],phthaloblu:18,bitbucket:[7,9,14,30],receiv:[10,8,29],longer:[10,13,28,33,8,20],furthermor:11,intimaci:28,ignor:[22,28,1,18],fact:[21,28,1,29,10,33,22,8],time:[21,33,10,0,1,12,2,29,4,16,13,11,6,18,22,28,8,20,36],push:7,backward:[36,30],osx:[7,31],concept:[21,9,10,0,11],chain:[9,11,12],skip:1,consum:[10,5,20],focus:4,invent:[10,35],cafelattedecaf:20,objcount:1,test_x_z:18,informit:20,metanewvsinit:18,primer:18,milk:20,row:[29,12],decid:[28,12,29,32,10,4,33,35,20],depend:[21,10,30,12,4,28,18,29,14],decim:33,intermedi:2,certainli:[21,28,29,12,10,4,35,20],decis:[13,16,36,33],jvm:10,text:[9,12,2,15,33,13,6,7,36],aspx:20,jtextarea:10,isinst:[16,18,31],sourc:[21,10,1,12,2,28,13,7,29,36],string:[9,10,11,1,12,4,33,28,18,29,36],brazillian:2,onlyon:22,"fa\u00e7ad":[9,37],broadli:28,word:[10,11,1,12,0,37,8],exact:[28,4,12,23],jdk:[10,1,29],level:[21,28,1,29,4,33,6,18,8],did:[33,10,6],die:36,gui:[0,4,29],iter:[21,9,10,1,12,4,33,16,28,27,18],launchpad:[2,13],item:[29,10,4,12,23],team:[2,7,30,9],quick:[9,10,1,33,7,20],round:[35,18],dir:[10,1,18,6],prevent:[9,28,1,29,4,35,18],plaincap:20,core:[7,33,10],htm:36,compens:21,sign:[7,10,14],bondag:8,cost:[21,20,12],cafelattewetwhip:20,run:[21,9,10,0,1,12,28,33,11,6,18,7,29,8,36,35],corba:10,appear:[21,10,11,1,12,13,8,29,4,33,28,18,22,14,30],filler:28,scaffold:4,current:[21,33,10,1,12,28,16,14,36],suspect:4,newalgorithm:11,shapefact2:4,deriv:[28,1,12,10,4,33,35,18,29],cappuccinodri:20,gener:[1,2,4,6,7,8,9,10,11,12,14,16,18,36,21,22,23,27,28,30,29,32,33,35,37],satisfi:[21,28,11,12,35],modif:[33,28,8,20,18],chainlink:11,address:35,along:[21,33,10,1,12,28,16,35],stem:10,teacher:17,wait:[29,10,28,12],box:[9,10,1,29,4],messengeridiom:5,fenc:21,alti:29,shift:6,clip4:28,queue:11,behav:[10,8,28,12],extrem:[7,28,10,8,1],commonli:[10,28],nmspc:18,trashtyp:28,semant:[33,1],regardless:[28,35],repositori:2,extra:[28,1,29,33,18,20],activ:[13,32,28,4],modul:[9,10,29,3,33,18,8],prefer:[13,18],toarrai:10,leav:[28,29],visibl:[33,10],codemark:6,instal:[9,10,1,29,28,7],forefront:1,gsum:28,anounc:7,newslett:21,prove:[28,8],univers:[21,4],visit:[32,10,28],recycleap:28,subvers:10,everybodi:29,live:10,handler:29,msg:33,scope:33,checkout:[7,14],testid:1,chapter:[33,10,11,1,2,8,28,16,13,34,36,18,38,14,20],capit:18,testpyutil:10,afford:11,peopl:[21,28,1,30,2,32,33,13,17,18,7,8],claus:[33,29,4,12],clue:28,visual:[7,9,29,13],appendix:2,rigid:10,oop:[21,28,1,29],examin:[10,28],alexand:16,jlabel:10,effort:[9,10,11,1,2,28,17],easiest:[7,9,10,32],simplemeta2:18,simplemeta3:18,fly:32,graphic:[36,1,29,4],ibm:18,prepar:8,dmitri:22,battl:[32,4],focu:[13,3,28],flowlayout:10,problemsolv:11,can:[1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,21,28,23,22,29,32,33,35,36,37],purpos:[21,28,11,4],problemat:16,claim:11,encapsul:[21,9,28,11,12,4],stream:10,predict:8,wrapped_f:8,explos:28,backslash:[33,10],topic:[2,33,22],heard:28,chih:22,abort:[1,6],proxydemo:35,recycl:[9,28],unfortun:10,occur:[21,28,11,1,12,13,4,23,29],pink:29,alwai:[21,28,0,1,30,10,33,22,14],killanddismemb:4,variou:[21,10,11,1,12,32,4,23,28,0,20],get:[1,2,23,6,7,8,9,10,11,12,13,16,17,18,19,20,21,28,29,32,33,37],ping:10,write:[21,9,10,0,1,12,2,4,33,16,13,11,6,18,29,28,35],anyon:[2,36],actual:[21,33,10,11,1,12,4,23,16,28,35,6,29,8],pure:[10,12],"0x00798900":22,parameter:28,ensconc:10,map:[10,12,32,28,33,36],product:[13,33,10,1],dialog:10,max:29,thermostatdai:[10,18],spot:[13,4],usabl:12,wantmor:12,inputb:12,inputc:12,mac:7,inputa:12,mymethod:29,aop:8,mai:[21,33,10,11,1,12,2,29,4,16,13,34,36,7,22,28,20],underscor:[13,33,22],data:[9,10,11,29,12,4,33,16,28,5,22],grow:34,goal:[21,9,10,1,12,2,28,33,8,36],my_login:7,practic:[33,18],johnson:21,divid:1,explicit:[21,11,8,23],cafelattewhip:20,inform:[10,11,1,12,31,8,29,4,23,33,28,5,18,7,22,14,36],"switch":[28,11,36,35],preced:20,combin:[9,10,11,29,2,23,18,20],block:[13,6],callabl:[8,29,18],talk:[7,21,10,28],vike:33,extractor:[14,1],dojo:17,comfort:[1,37],countobserv:29,greenhouselanguag:[10,18],brain:[33,11],lst:10,codemanag:[6,18],still:[21,10,28,29,12,2,4,33,13,6,18,7,14],stringlist:28,dynam:[21,9,10,11,29,32,4,23,33,28,35,8,20],rosetta:17,group:[21,28,11,29,2,32,33,6,18,7,36,17],thank:[9,30],polici:0,jim:[28,11],platform:[9,10,31],window:[9,10,31,13,15,7,14],curli:33,borgsingleton:22,truli:[],ddtrash:28,non:[21,10,1,2,28,33,18],within:[21,10,29,12,4,33,28,18,8],halt:1,halv:33,sysconf_nam:31,alist:7,initi:[21,10,0,29,12,4,33,28,35,18,7,22,14,36],sorter:28,underneath:7,typedbinmemb:28,pyinteg:10,aesthet:28,therebi:1,half:35,javaclassinpython:10,now:[21,10,1,12,32,4,28,36,18,7,8,30],discuss:[21,28,36],introduct:[9,2,33,18,7,8],term:[21,28,11,1,12,35,37,8],name:[21,10,0,1,12,13,8,29,4,23,33,28,35,5,6,18,7,22,14,20],ppr:28,getweapon:32,didn:[21,33,14,1],oliv:20,phyast:8,separ:[21,10,0,1,12,32,4,33,28,11,18,7,29,35],rock:23,cafemochadecafwhip:20,pizza:20,jmap:10,compil:[21,10,11,1,29,28,33,35,6,18,19,8],domain:10,replac:[10,11,1,13,32,33,18,8],individu:[7,28,36,20],arg3:8,continu:[28,1,12,10,33,6],tag3_method:18,contributor:[2,9,14,30],parsetrash:28,significantli:8,begun:21,year:[16,21,28,1],happen:[21,10,28,1,12,2,4,13,18,29,8,20],dispos:10,troll:32,shown:[21,28,11,32,10,4,33,20],accomplish:[22,37,29,10,33,28,35,18],cafemochawhip:20,"3rd":[16,20],space:[28,13,10,33,35,6,36],profit:[2,10],antoin:21,profil:10,stuff:13,internet:[1,36],returnstr:10,factori:[21,9,28,12,4,37],"0x7ed70":18,overidden:12,earlier:28,"goto":28,state:[21,9,28,11,29,12,4,33,35,22],getcwd:1,argu:[13,3,16,8,21],argv:6,lab:28,org:[10,11,1,30,14,33,18,7,29,8],"byte":[10,36],care:[13,33,28,4],reusabl:[16,28],couldn:[28,11,1],yarko:[7,14,30],synchron:29,junit:1,recov:28,thing:[21,10,11,1,29,2,28,23,33,13,35,18,7,8],place:[33,10,28,1,12,2,4,16,13,5,17,7,29,8,20,19],greenhous:[38,10,18],principl:[21,9,28,1,12,37],typic:[21,28,11,1,12,33,0,5,18,8,20],think:[21,33,10,11,1,29,2,28,23,16,7,8,20],frequent:28,first:[21,9,10,0,1,12,33,29,4,23,16,28,35,6,18,7,22,37,8,20,36],oper:[21,9,10,11,33,12,32,15,4,23,16,28,18,7,8],directli:[28,0,1,2,10,33,18,22],carri:[28,11,12],onc:[21,10,29,28,6,18,7,8,20],arrai:[21,28,12,10,4,33,37,36],getcost:20,crib:31,yourself:[10,12,2,28,33,7],submit:1,ring:[10,18],open:[10,0,1,12,2,28,13,6,18,7,29],size:[2,29,10,1,20],given:[28,0,12,29,10,4,35,36],ian:18,sheet:[7,1],convent:18,stuck:1,teardown:1,caught:12,adjac:29,plastic:28,gnureadlin:10,circl:[18,4,12],showdigit:12,white:[9,28,1,29],conveni:[22,29,13,10,4,35,18,20],cite:36,pocoo:[14,30],simionato:[8,18],cope:28,copi:[28,12,29,2,35,6,7],specifi:[10,1,12,2,4,33,7],broadcast:12,newcolor:29,enclos:20,enigma:28,changeavail:12,registerleafclass:18,holder:28,than:[21,33,10,11,1,29,13,32,4,23,16,28,35,18,8,20],png:7,serv:[21,4],setattr:22,instanc:[10,1,12,23,18,22,20],applet:0,bintyp:28,were:[10,1,12,4,33,28,18,8],posit:[36,29],stub:35,surrog:[11,37,20,35],seri:8,fork:7,coconut:33,nicer:[7,37,29],svnroot:10,argument:[21,9,10,11,1,12,4,33,28,5,18,29,8],ant:10,prt:10,properli:[10,8,28,23],deliv:10,breakfast:29,kevin:29,leastsquar:11,engin:[32,0,1],squar:[29,4,18],patternrefactor:[28,11],note:[1,4,6,7,8,9,10,11,12,13,15,16,18,19,20,21,28,22,30,29,33,34,35,36],forc:[21,33,10,1,29,2,4,16,35,6,18],ideal:10,take:[21,33,10,0,1,12,2,32,29,4,16,28,11,18,7,22,37,8,20,30],green:[29,18],wonder:18,noth:[21,28,11,1,29,13,36],begin:[21,10,30,13,28,33,7,8],sure:[2,33,10],trace:[8,1,29],normal:[21,28,11,1,32,4,33,18,22],track:[28,12,29,2,35,5],price:[2,28,20,12],drinkcompon:20,beta:10,wire:[28,22],pair:[28,37],neatli:35,televis:22,latex:[7,13,14,30],synonym:21,later:[21,10,11,1,4,28,18,7,22,8,20],sale:2,quantiti:[29,28,22,12],addbranch:7,runtim:[9,10,11,4],parseint:29,link:[7,13,11,14],shop:[2,20],shot:[28,20],linedata:11,show:[21,33,10,11,1,13,3,15,4,16,28,6,18,7,22,8],cheat:7,cheap:[21,28],subprocess:10,mousetrap2test:12,concurr:[3,9],permiss:[10,1],hack:[7,14],ground:10,xml:[10,37,18],onli:[0,1,2,4,6,7,8,10,11,12,13,16,18,20,21,28,23,22,29,32,33,35,37],explicitli:[28,10,4,33,18,8],nexta:12,nextb:12,nextc:12,transact:21,observedflow:29,enough:[10,1,29,13,28,4,7],doubleespresso:20,dict:[22,10,5,6,18],analyz:21,jaroslav:28,clearselect:12,startswith:[6,18],proxy2:35,nearli:1,viewpoint:28,distinctli:12,ddaluminum:28,cannot:[21,33,10,0,12,32,28,16,22],ssh:7,afunct:8,gen:4,requir:[21,33,10,1,12,4,16,28,34,5,6,37,7,29,8,20],jtextfield:10,prime:[28,1,29],reveal:36,isemptyxi:36,aluminum:28,dramat:1,yield:[3,32,4,23],spameggssausageandspam:10,expedi:1,pynam:10,makec:37,through:[21,33,10,11,1,12,2,29,4,23,16,13,35,18,22,28,8],where:[21,10,11,29,12,2,4,23,33,19,5,6,7,28,8,36],vision:2,summari:[9,10,28],wiki:[10,11,30,28,7,8],"__module__":18,onlamp:18,pydictionari:10,booch:28,cafelattewet:20,testcas:[],rmi:35,purest:11,concern:[28,8,1],timeit:10,detect:[28,23,36,31],charat:10,review:[7,9,8,1],enumer:[16,18,6,12,23],label:[10,14,30],getattr:[22,35],trashbinset:28,between:[21,10,1,12,28,35,18,7,29],"import":[21,10,0,1,12,2,3,4,23,33,13,5,6,18,32,29,28],item2:23,across:[10,4],aslist:10,docutil:[],assumpt:[32,28],parent:[7,10],tup:10,screen:[28,0,1,29],inflex:20,cycl:33,pythoncardapp:29,findminima:11,come:[21,10,1,12,2,29,4,33,28,6,7,22,36],readlin:[10,28,12,36],tug:7,ispubl:1,simple4:18,pepperdew:20,quiet:28,contract:2,inconsist:8,improv:[9,28,30,12,2,22,33,13,7],somecondit:1,minima:11,color:[13,29,18,36],overview:[7,9,28],unittest:[28,10,1,12],period:33,dispatch:[9,28,29,32,4,23],yearli:28,colon:[33,10],exuperi:21,consider:[9,28,20],mousetrap:12,coupl:[21,9,28],games2:4,west:36,rebuild:10,mark:[21,33],appframework:0,quiesec:12,reflex:21,astonish:21,spare:33,bypass:18,emphas:[13,28,10,4,18],test_x:18,further:[21,9,10,1,29,13,3,28,33,18,8,20],trantabl:12,cafelatteextraespresso:20,findal:6,repres:[33,28,12],"__eq__":[23,12],former:[16,22,18],those:[21,10,1,29,2,4,23,33,28,5,17,18,7,8],newbyt:36,sound:[2,8],myself:[8,17],tostr:10,keygen:7,trick:[10,5,28],cast:[10,28,37],invok:[10,1,28,23,33,18,7,8,20],outcom:[4,23],invoc:20,simple3:18,anytim:[13,29],advantag:[16,22,10,28,12],stdout:10,canon:[9,15],ivi:7,worri:[2,13,16],equal:[21,28,10,1,33],endswith:[10,6],eras:[1,4],myapp:0,couplet:28,shutil:6,fame:28,"__init__":[9,10,0,1,12,33,37,29,4,23,16,28,11,5,6,18,22,36,8,20,35],develop:[21,9,10,1,2,13,18,7,20],author:[11,29,18],fulful:11,same:[21,33,10,11,1,12,13,29,4,23,16,28,35,18,22,8,20],trip:2,binari:7,html:[10,30,13,8,28,33,6,18,7,14],testrunn:[],customize1:0,pai:[2,10,28],document:[10,1,29,13,8,33,7,14],pollut:21,number_of_processor:31,nest:[33,22,4,20],foam:20,someon:[7,14,29],driven:[38,9,1,12,36],mani:[10,1,12,2,29,28,33,18,7,22,8,20],extern:[9,28,1,12,6],tosynch:29,tradition:[33,1],hummingbird:29,appropri:[21,10,11,1,12,32,4,33,28],macro:[9,11,8],facad:37,connector:21,pep8:13,gameenviron:4,without:[21,9,10,28,1,29,2,4,33,16,13,7,8,20],temptat:18,model:[21,32,28,29,20],dimension:[37,12],arrays2:33,"23f":28,execut:[9,10,11,1,29,4,23,33,28,7,8],excel:[16,18],thermostatnight:[10,18],rest:[21,10,0,1,12,2,4,28,6,7,8],recyclea:28,aspect:[21,10,8,4,29],recycleb:28,touch:[32,28],monei:[2,12],flavor:11,speed:10,pythondecoratorlibrari:8,except:[10,0,1,12,28,23,18,8],littl:[21,10,1,12,28,33,7,8,36],blog:[7,21,18],pile:21,treatment:28,exercis:[9,10,11,1,12,32,29,4,28,0,17,37,22,20],catonmat:21,real:[10,11,36,35],around:[21,28,1,29,13,32,4,33,35,5,36,8,20],todolist:[14,30],"0079ef2c":22,repaint:[36,29],grid:29,pop:[10,28,18],amp:[3,1],rununittest:1,appetit:21,returnarrai:10,mod:36,saniti:1,colorbox:29,stranger:21,chainofrespons:11,integ:[33,10,29],benefit:[10,29,2,28,33,13,35,20],either:[21,10,11,29,23,33,18,20],output:[10,0,1,12,13,8,22,33,30,18,7,14,20],margherita:20,manag:[21,10,11,12,29,32,22],fulfil:[21,11,35],tulach:28,satisfactori:28,adequ:[21,33],inlin:18,constitut:29,nonzero:1,regina:20,slice:10,mood:12,chronicl:21,boxobserverpythoncard:29,definit:[28,0,1,2,10,33,35,8],ddj:20,evolv:[13,21,10,28,1],exit:[36,8,1,29,6],inject:[10,8,18],complic:[28,35,1,20],ratcount:36,refer:[21,28,1,12,2,4,23,33,13,35,36,18,7,22,20,19],power:[22,10,28,18,7,8],cappuccinoextraespressowhip:20,garbag:[10,1],inspect:[7,9,6,18],typedbin:28,standpoint:1,"__name__":[10,11,1,29,32,4,23,33,6,18,8,20],"throw":[16,10,1,12,4],comparison:[10,18,4,12],central:[16,28,12],greatli:28,strategypattern:11,firstnam:7,camembert:18,conditionc:12,panna:20,splitlin:6,currentlin:36,stand:[21,32,28,35],neighbor:29,act:[21,28,11,8],other:[0,1,2,4,7,8,9,10,11,12,13,14,15,16,18,20,21,28,23,22,29,32,33,35,36,37],routin:35,effici:28,activest:18,lastli:[16,10],obstacl:4,quietli:10,"75f":20,strip:[28,20,1,12,6],counterintuit:28,your:[0,1,2,4,6,7,9,10,11,12,13,15,16,18,20,21,28,23,22,29,31,32,33,35],wustl:28,log:29,aren:[21,18,1,13,33,37],cpu:31,commenttag:6,overwrit:6,hee:35,stealth:10,interfac:[21,9,10,11,29,12,32,4,33,16,28,35,37,20],low:[21,28],lot:[21,10,1,12,2,28,33,18],pollin:32,strictli:28,machin:[7,9,12,31],unam:10,lang:[10,28,18],tupl:[33,10,5,6,23],bundl:37,regard:21,vendingmachin:12,stepanov:16,conciev:12,"0076aa3c":22,functor:11,mice:12,conclus:16,faster:[10,1],notat:10,tripl:33,algorithm:[21,9,28,11,29,4,16,36],impenetr:1,possibl:[21,10,28,1,12,2,4,33,13,35,36,18,22,8,20],"default":[28,11,1,29,31,10,18,7,36],asynchronizedmethod:29,grasp:33,embed:10,connect:[21,22,11,29,12,10,28],gone:[10,11],creat:[0,1,2,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,20,21,22,23,28,29,30,32,33,35,36,37],certain:[28,12,15,10,18,20],whatihave2:37,strongli:33,intro:[14,18],file:[9,10,0,1,12,13,15,28,33,11,6,7,29,14,36],jargon:32,rearrang:16,cream:20,incorrect:16,again:[2,28,10,1,33],setval:10,googl:7,want:[21,33,10,11,1,12,2,29,4,23,16,13,35,5,37,7,22,28,8,20,30],tradeoff:20,my_decor:8,compel:[21,10,6],depth:18,event:[21,10,0,29,18,36],idiom:[21,9,11,29,25,35,7],valid:[10,1],compet:23,jset:10,you:[0,1,2,4,5,6,7,8,9,10,11,12,13,15,16,18,19,20,21,28,23,22,29,31,32,33,35,36,37],getdescript:20,interactwith:4,architectur:[2,21,10,29],check_result:6,registri:[10,18],sequenc:[21,33,10,11,12,28,16],tbin:28,vocabulari:21,pool:22,reduc:[1,20],assert:[37,18,1,12,4],multiplejython:10,opennotifi:29,directori:[10,1,13,28,6,7,14],descript:[10,1,12,28,6,18,7,22,14,20],hello:[10,8,12],gradient:21,mass:29,potenti:[21,29],escap:12,fillabl:28,represent:12,all:[0,1,2,4,6,7,8,10,11,12,13,16,18,19,20,21,28,23,22,29,32,33,35],dist:10,skeleton:35,messi:[28,23,31],lack:[10,1],dollar:12,sanitycheck:1,monti:33,abil:[21,29,2,32,13,18,8],follow:[21,10,28,1,12,2,4,23,33,13,35,5,18,7,29,8,20],research:[2,10,37],hashmap:[10,28,12],uses_metaclass:18,edong:7,"__cmp__":[10,18,12],init:0,program:[21,9,10,11,29,1,12,33,2,15,4,23,16,13,6,18,22,28,8],hasattr:[18,31],rstrip:6,contentpan:10,fascin:18,"case":[33,10,11,1,29,2,4,23,16,28,35,5,18,22,8,36],liter:[33,23],straightforward:[21,10,28],fals:[28,10,6,12],checkin:[7,14],faq:[7,33],util:[33,10,1,29,16,7],defvar:7,candid:[16,21],mechan:[9,28,0,13,23,16,33,11,18,8,35],fall:[8,1,31],veri:[21,9,10,11,1,29,2,4,23,33,13,7,22,8,36],bottleneck:10,bruceeckel:[7,16,10,21,1],lisp:8,list:[21,9,10,0,1,12,2,8,4,23,33,28,11,5,6,18,7,29,14,30],signific:[13,16,28,1,36],emul:[29,18],asingleton:18,small:[2,13,21,20],everth:15,dimens:29,tag1:18,tag2:18,tag3:18,pyobject:10,tea:20,eas:[28,20,12],tee:35,tex:7,zero:[10,1],pressur:1,design:[21,9,10,11,1,12,13,32,29,4,33,16,28,35,6,37,22,8,20],pass:[10,11,1,12,32,29,4,23,33,28,35,5,18,7,22,37,8,20],whene:35,val2:33,new_f:8,deleg:[28,35,22],brien:28,ntotal:28,advanc:[2,11,18],abl:[21,10,0,1,12,2,4,23,16,13,11,28,36,35],brief:33,overload:[33,10,28,18],version:[10,28,29,12,2,8,4,23,33,13,18,7,22,37,14,19],succinct:[10,8],fillbin:28,method:[21,9,10,0,1,12,32,29,4,23,33,28,11,6,18,22,37,8,20,35],contrast:33,movement:[21,28,11],hasn:[28,29,18],full:[7,33,10,35,6],themselv:[21,33,29],variat:[21,28,37,22,12],sophist:[33,10,1,4],rlock:29,shouldn:[7,11],excess:12,demet:21,rudimentari:33,modifi:[10,28,1,12,2,32,29,4,23,33,13,18,7,22,8],valu:[10,1,12,28,23,33,5,6,18,37,8],search:[9,28,0,1,33,18,7],upcast:[28,4],ahead:[33,1],vegetarian:20,popen:10,observ:[21,9,28,1,12,22,29],prior:28,amount:[28,11,1,12,15,10],pick:28,action:[21,9,10,11,12,4,28,35,18],introductori:[9,10,2,33,7,8],scurri:36,pytupl:10,via:[10,2,28,23,18,7],shorthand:10,primit:[10,28],transit:[9,12],"while":[21,10,11,1,12,2,28,33,35,18,36],readili:21,filenam:[28,6,36],inappropri:[10,1],ystart:36,famili:[28,11,23],viewpost:18,establish:[16,33,28,1,12],jbutton:10,select:[21,9,10,11,29,12,13,28,7,20],kittiesandpuzzl:4,aggress:33,twa:10,proceed:28,distinct:[21,22,11,12,10,28,35],tackl:28,two:[10,0,1,12,2,32,29,4,23,33,28,35,6,18,22,37,8],bizarr:8,getweight:28,autonom:36,machinediscoveri:31,taken:[13,28,10,1,4],automati:[],showtot:12,singletonmetaclass:22,more:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,20,21,22,23,28,29,30,32,33,35,36,37],flaw:1,door:12,mydialog:10,apologet:8,reconfigur:32,convinc:1,ddcardboard:28,flag:[10,29],stick:[8,18],particular:[21,33,10,11,1,12,2,4,16,28,35,36,18,7,22,20],known:28,compani:[2,10],cach:10,dictat:2,none:[22,12,1,29,10,33,18],pyprog:1,valuabl:28,dev:7,histori:[7,9,8,6],testdemo2:1,remain:[16,28,12],caveat:[19,1],learn:[21,28,2,33,13,7],returnchang:12,statedemo:35,dee:35,def:[0,1,4,5,6,8,10,11,12,16,18,36,22,23,28,29,31,32,33,35,20,37],prompt:7,scan:13,challeng:36,registr:[9,18],share:[2,7,22],accept:[10,32,28,16,18,7],fiddl:35,minimum:[7,33,10,29],explor:16,statet:12,phrase:1,magenta:29,condemn:28,huge:20,cours:[21,10,1,30,2,4,28,35,37,20],newlin:33,awkward:10,secur:[10,8],programmat:[20,18],anoth:[21,10,11,29,12,32,4,33,28,35,18,7,22,8,20],mouseact:12,myratno:36,ish:[13,33],smalltalk:[21,29],simpl:[9,10,0,1,12,4,33,28,35,18,7,29,37],css:[14,30],distro:10,plant:28,resourc:[9,1,29,37,14,36],algebra:16,variant:28,reflect:[9,10,28,1],tabl:[9,12,32,23,16,33,35,38],associ:[33,10,28],"short":[33,31],waysid:1,ani:[21,33,10,28,1,12,2,29,4,16,13,35,36,18,7,22,8,20],confus:[28,37,29,32,33,18,8],ambigu:10,caus:[21,10,1,12,32,4,33,28,7,29],flwr:32,"0x7ecf0":18,setchang:29,egg:[33,22],sysctl:31,help:[21,28,29,2,3,13,35,17,7],mazework:36,soon:1,held:[21,35,12],pythondialog:10,paper:[28,23],scott:21,cyan:29,hierarchi:[21,28,11,32,4,23,33,35],taxonomi:[21,9],implicitli:[21,33,10,4],realiz:[16,21,28,1,33],paramet:11,latt:20,style:[11,1,12,13,33,30,18,14],conjugategradi:11,alli:17,late:[28,20],rapidli:[10,29],runal:12,pythondecor:8,might:[21,10,11,1,29,2,4,23,16,28,8,36],attch:[],currentst:12,wouldn:[28,1,4],good:[21,10,1,12,2,28,33,13],"return":[33,10,11,1,12,31,32,29,4,23,16,28,35,5,6,18,22,37,8,20,36],martelli:[21,22],ringbel:18,ttbinlist:28,framework:[21,9,10,0,1,12],somebodi:[2,7],complain:33,bigger:[10,12],whatiw:37,intricaci:4,customize2:0,hook:[9,29,18],solver:11,instruct:[7,1],refresh:[14,6],easili:[21,10,11,1,12,28,23,5,18,22,37],achiev:[28,10,18,22,8,20],compris:8,getmodifi:1,found:[21,28,1,14,36,7,8,20],max_num:28,button:[7,10,4],harm:[9,28,12],weight:28,hard:[13,16,28,4,32],idea:[21,10,11,12,2,8,4,13,35,17,7,28,14],procedur:28,realli:[21,22,11,12,10,33,28,37],finish:[21,10,1,12,7,8],evalpap:23,windowadapt:29,ddpaper:28,http:[21,10,11,1,12,8,28,33,30,36,18,7,29,14,20],todo:[9,10,30,6,7,14],orient:[21,28,11,10,4,33,8],flower:[9,29,32],safeti:[33,1],classvariablesingleton:22,differentreturn:33,miss:[21,28,10,6],setsiz:[36,29],publish:[2,28,10,1],princ:21,footnot:[21,10,11,1,12,28,22,14],gameelementfactori:4,print:[0,1,2,4,5,6,8,9,10,11,12,13,14,18,20,28,23,22,29,32,33,35,36],qualifi:[33,1],lutz:33,proxi:[21,9,10,12,22,16,35,37,20],hashset:10,pub:18,reason:[21,10,11,1,12,2,4,33,28,35,18,37,8,20],base:[21,10,0,1,12,2,32,29,4,23,33,28,11,18,7,22,36,35],put:[21,9,10,28,1,12,2,8,4,33,13,5,6,18,7,22,14,17],teach:[2,9,1,17],bash:1,basi:[1,29],thrown:28,thread:[7,29,18,36],script:[13,9,10,11,33],struggl:21,revolutionari:1,perhap:[28,1,13,32,10,4,37],pythonsw:10,ascher:33,trashsort:28,lifetim:35,clump:5,assign:[10,33,5,18,7,8],major:[33,8,18],notifi:29,obviou:[16,28],blush:28,feel:[7,13,21,1],articl:[3,15,20,18],lastnam:7,number:[21,10,11,1,12,31,13,29,28,23,33,35,36,37,7,22,8,20],placehold:12,sayhello:8,done:[10,11,1,30,2,4,33,13,18,7,29,14],least:[21,10,1,28,33,7],colorboxestest:29,stabl:10,actionperform:10,fanci:12,gpl:10,razor:21,differ:[21,33,10,11,1,12,8,4,23,16,28,35,6,18,32,7,29,14,20],decoupl:[16,9,11,29],printstacktrac:[28,1],interact:[32,10,4,37,23],tove:10,construct:[16,10,8,1,18],addfactori:4,paint:[13,36],toi:18,expand:[7,35],statement:[10,11,1,12,4,33,28,35,29,8],scheme:[32,28,29],syrup:20,store:[8,1,12],itempairgen:23,imperfect:13,option:[21,11,29,2,33,6,7,20],relationship:[21,18],behind:[21,35],checklist:21,bsingleton:18,shapefactory1:4,shapefactory2:4,convieni:18,pars:[33,9,28,23],consult:2,off:[21,10,29,2,15,28,33,18],eventu:[21,1],tortoisehg:7,albeit:[21,33,10,28],kind:[21,33,10,1,12,2,32,4,23,16,28,35,29,8],plop:28,whenev:[21,28,0,29,4,5,7,8],remot:35,gotten:12,remov:[21,28,29,12,2,16,18],kapow:10,pythoninterpret:10,reus:[21,28,0,12,10,33,11,22],getconstructor:[10,28],singletondecor:[22,18],toward:[21,1],danc:35,builder:[],runsawai:12,comput:[10,28,18],nastyweapon:4,ardent:1,requisit:1,"null":[35,1,12,36],sell:2,imagin:[28,4],"0x7ed30":18,built:[21,9,10,11,1,29,2,28,33,35,7],equival:[28,1,29,10,33,18],restfil:[10,6],self:[0,1,4,5,6,8,9,10,11,12,16,18,36,21,22,23,28,29,32,33,35,20,37],violat:10,typediter:16,also:[21,33,10,11,1,12,2,29,4,16,13,36,17,18,38,7,22,28,8,20,30],bgboxobserv:29,build:[9,10,0,1,33,2,32,37,4,16,13,18,7,28,14],mouseev:29,brace:33,distribut:[7,13,10,4],exec:[10,18],blackboard:36,eater:32,lighton:[10,18],reach:[21,11,36],mixtur:20,addobserv:29,most:[21,10,0,1,29,2,4,28,11,5,8,20],plai:[32,28,4],jsp:18,cygwin:7,eaten:32,thidiscuss:11,maco:31,alpha:10,amaz:[10,8,36],fileread:36,bug:[7,32,28,1],clear:[21,12,29,2,18,8],cover:[2,13,34,0,1],roughli:[1,12],"_shared_st":22,ext:[14,30],part:[21,9,10,0,1,29,2,8,28,26,33,24,25,11,6,18,7,14,20,36],clean:[33,28,10,1],jython2:10,xstart:36,latest:7,mousetrap2:12,mousetrap1:12,tri:[10,11,28],test3:[10,1],flowergen:32,canvaswidth:36,particularli:[13,33,28,23],uncov:10,font:[2,10],fine:[28,4,18],find:[21,10,11,1,2,4,33,13,18,7,28,8,20],impact:[28,8],less:[21,28,1,13,5,18,8,20],solut:[21,10,11,1,12,29,4,23,28,18,22,20],pyutil:10,templat:[9,10,0,12,2,4,33,16,13,11,28,8],darkgrai:[36,29],shapefact1:4,affirm:[33,1],unus:21,cappuccinodecaf:20,express:[21,10,1,13,23,33],entry_exit_class:8,swing:10,nativ:[7,10],mainten:[28,20],wateroff:[10,18],ineffici:29,doubli:29,classset:[],cyclic:12,stl:[16,10,11],common:[21,10,1,12,2,4,33,28,35,17,29],wrote:[10,1],commod:28,cafemochawetwhip:20,pyexcept:10,adopt:1,creator:[7,11,30],overwhelm:[7,18],startup:[7,10],potent:10,emac:[7,9,14],bare:29,aluminumbin:28,arg:[28,1,29,10,33,18,7,22,8,36],close:[29,1,12,36],horizont:36,cafelatt:20,analog:33,dwarf:32,expert:[13,11],someth:[21,10,11,1,12,2,32,28,23,33,13,17,37,29,8,20],artima:18,conditionb:12,conditiona:12,weakli:[],won:[10,29,2,28,33,13,18],mutex:29,autogener:[14,30],experi:[2,21,10,8,1],nope:1,birkenfeld:7,altern:[21,10,1,3,28,18,8],signatur:[33,10],str:[33,29,18],numer:[0,5,11,23],hasnext:[16,28,10,1,12],complement:21,sole:11,isol:[21,28,11,4],statemachin:[9,12],disallow:[4,18],cachedir:10,len:[11,36,1,29,6],solv:[21,10,11,1,12,3,28,23,33,35,18,32,29,37,36],extraespresso:20,both:[21,10,29,13,4,23,33,28,35,36,18,7,22,8,20],"__instanc":22,last:[32,10,0,28,18],hyperlink:14,arraylist:[10,28],alon:[28,29],undetermin:0,context:[9,11,14],forgotten:15,commandpattern:11,whole:[28,11,1,12,2,10,29],load:[28,10,4,37,7,36],randomli:[32,1],simpli:[21,33,10,0,30,12,32,28,16,35,5,37,29],point:[21,28,11,1,12,31,2,29,4,33,13,18,7,22,8,36,19],instanti:18,schedul:[32,10],sweep:1,ceruleanblu:18,arbitrarili:[35,18],header:7,templatemethod:0,param:10,linux:[7,14,18,31],throughout:[21,28,0,1,13,4],simpler:[21,22,1,29,28,35,18,8],identif:28,java:[9,10,1,12,33,4,23,16,28,35,6,18,19,29,8,36],dum:35,due:1,empti:[36,29],sinc:[21,10,11,1,12,4,33,28,35,18,29,8,20],mercuri:[7,9,14,30],newinst:[28,1],pushnew:7,strategi:[9,11,6],addison:[28,11],versa:33,execfil:10,clariti:[13,20],imag:[13,29],convert:[10,0,29,12,16,18,14],coordin:36,changeimp:35,understand:[21,10,12,13,28,33,18,22,8],demand:[2,33,35,1,4],makedir:6,fillablevisitor:28,look:[21,10,11,1,12,13,8,29,4,33,28,35,18,32,7,22,14,20,30],packag:[33,28,10,1,12],frozen:29,buildtabl:12,getquant:12,decrquant:12,smart:[10,35,12],behavior:[21,10,11,29,12,28,23,16,18,22,37,8,36],sublclass:18,"__hash__":12,anonym:[9,28,38],fum:10,everyon:[30,29,2,33,13,17],errmsg:1,pack:10,argin5:10,argin4:10,pound:33,argin1:10,argin3:10,argin2:10,readi:[2,7,28,0,36],petal:29,itself:[21,10,11,12,13,28,8,36],makea:37,coroutin:[3,9],attach:[13,9,18],chase:4,decor:[9,28,29,8,22,16,18,14,20],guido:30,minim:[21,1,29],boxwidth:29,belong:2,on_openbackground:29,shorter:10,read:[21,9,10,0,1,12,31,2,3,28,33,6,18,29,8,20,36],conflict:[7,9,18],"__repr__":18,cappucino:20,vertdir:36,optim:[10,28],painless:28,wherea:[33,10,11,28,12],wilson:8,setbackground:36,user:[9,10,29,12,2,4,16,28,7,22],cardboardbin:28,focal:21,recent:[10,1],propon:28,task:[7,13,29],lib:33,eleg:[21,28,22,33,35,8],openobserv:29,entri:[13,8,10,14,36],localarrai:29,propog:29,parenthes:33,jythonc:10,testpythontojavaclass:10,chees:12,expens:[28,35],elev:[28,12],academ:1,imit:[7,33],propos:[7,21],explan:10,pyfloat:10,valueof:28,obscur:21,shape:[28,4,18],world:[21,10,11,8,1],"67f":28,dumpclassinfo:10,dirlist:11,cut:[28,37,29],indexof:[10,28],mydecor:8,bick:18,branch:[7,9,28,14,36],snag:29,correcton:2,appli:[21,28,12,1,29,33,37,8],input:[3,0,12],subsequ:[33,18,12],brainstorm:21,bin:[7,28,10,1],tomap:10,vendor:[32,28],transpar:[10,1,20],big:[33,8],intuit:10,game:[4,29],alias:35,verion:7,bit:[33,10,29,2,28,4,16,35,8],characterist:0,formal:[33,8],fillablecollect:28,success:[21,10,11,1,28,16],nextstat:12,signal:10,resolv:[28,18],fluf:13,collect:[21,22,11,1,12,28,37],"__new__":[9,22,18],sizeabl:20,javabean:10,encount:[28,1,29,10,4,16],"0076daac":22,often:[21,10,11,1,12,2,32,15,28,33,13,5,17,18,29,37,8,20],acknowledg:[21,33],creation:[21,9,10,28,1,12,2,29,4,33,16,13,18,22,8],some:[0,1,2,3,4,5,7,8,10,11,12,13,14,17,18,36,21,23,28,30,29,31,33,37],back:[21,10,11,1,12,2,28,29,8,36],global:[10,1,18],understood:[10,1],wxpython:29,mirror:21,sprint:2,surpris:[33,8],mousepress:29,syndrom:28,rien:21,scale:[3,10,1],chocol:20,mousemov:12,though:[22,28,8,1,29],per:[21,29,20,12,33],usernam:7,substitut:[33,8],mathemat:[11,23],larg:[10,12,2,3,28,34],market:32,fornam:[28,1],reproduc:2,norvig:29,cgi:[33,28],futuer:[],addel:36,patient:10,lose:[32,10,28,23],agreement:10,viabl:21,step:[21,33,10,1,2,4,16,28,18,7],initialst:12,subtract:[21,18],impos:[16,12],sellimaginaryproduct:32,constraint:[21,33,28,12,2,16,8],materi:[2,13,10,17],memori:1,libero:12,modal:10,cappuccinodrywhip:20,gamma:21,plan:10,predat:32,repair:28,"__future__":[32,4,23],emphasi:18,pythonpath:33,dispens:12,oreilli:33,fowler:[28,8],rapid:10,"caf\u00e9":20,ensur:[7,21,35,1,6],chang:[21,9,10,0,1,12,13,32,29,4,28,34,35,6,18,7,22,37,8,20],artifici:1,occupi:33,inclus:[21,33],institut:1,spam:[33,22,29],valuminum:28,question:[7,21,10,28,12],fast:[13,33,10,1],custom:[7,10,0,28,20],clip3:28,clip2:28,clip1:28,arithmet:36,includ:[21,33,10,29,1,12,15,28,16,30,17,7,22,8,20],suit:1,forward:[21,10],jarrai:10,blueprint:[2,7],larri:28,hawaiian:20,great:[2,19,10,21],sc_nprocessors_onln:31,quiescent:12,translat:[21,9,10,28,1,12,2,4,23,16,13,29,14,36],delta:6,line:[9,10,0,1,12,8,15,28,33,11,5,6,7,29,14,36],talli:28,info:[28,5,29],concaten:33,consist:[21,28,1,29,13,4,33,18,20],balabanov:22,strang:[33,4,12],jpython:10,priveleg:10,fillrect:[36,29],pythoncard:29,similar:[21,10,11,1,12,28,33,35,18,29,8],toomuchaccess:1,parser:28,chao:1,doesn:[21,10,29,12,2,8,28,23,33,13,6,18,22,37,14],lectur:[21,17],"char":[10,36],guarante:[7,12],cafe:20,blackboxtest:1,titl:[10,29],water:[10,18],windowi:7,appendic:13,intvalu:10,tbinlist:28,"_imag":13,mouseclick:29,getbound:36,cappuccinoextraespresso:20,nice:[2,7,33],draw:[0,4,36,23],getdeclaredclass:1,pythoninterpreterget:10,state_d:35,topydictionari:10,est:21,eval:[4,23],itemavail:12,pymeta2:18,pricevisitor:28,svn:10,jc2:10,vice:33,downcast:28,actionlisten:10,entryset:10,normpath:6,discrimin:33,jpanel:29,greenhousecontrol:10,mindlessli:28,karma:[2,13],far:[21,33,28,1,18],java2pi:10,showmsg:33,prototyp:[21,9,10,28],code:[0,1,4,6,7,8,9,10,11,12,14,15,16,17,18,20,21,28,29,32,33,35,36,38],partial:33,unclassifi:28,scratch:[10,8],tclone:28,ellips:18,"__getattr__":[22,35],edu:[28,8],benevol:2,privat:[22,0,1,29,10,7],successfuli:10,elsewher:13,friendli:1,send:[2,33,10,35,28],simplemeta1:18,granular:1,becam:1,paperscissorsrock2:23,sens:[21,10,11,1,4,33,28,5,18,8,20],ajout:21,sent:10,func2:8,func1:8,cheapli:[10,28],mainstream:8,sausag:22,mous:[29,12],testdemo:1,electron:[2,13],alik:2,volum:[2,13],whatius:37,makeschang:12,kitti:4,recip:[9,18],magic:22,counterproduct:28,knight:35,proxyadapt:37,fewer:18,"try":[21,10,11,1,29,13,28,37,7,8,36],session:12,mousetraptest:12,myfunct:33,pleas:[2,7,14,19],boxobserv:[1,29],"__metaclass__":[22,18],readabl:33,natur:[28,1,29,13,33,8,36],verbiag:33,elisp:7,annot:[8,12],jump:8,slithi:10,binset:28,video:21,changeneighbor:29,odd:[35,20],click:[7,13,29],append:[10,11,1,29,33,6,18,7],compat:30,index:[9,10,11,13,28,5,7,14],pymeta:18,compar:[28,11,1,10,18,7],espresso:20,access:[22,1,29,4,33,35,8],deleteobserv:29,runuculu:32,mouseadapt:29,whatev:[13,28,1],ibid:21,all_nam:6,mikewatkin:18,getmethod:[10,28],closur:8,intercept:[9,18],let:[10,1,12,13,4,28,8,20],becom:[21,33,10,1,12,28,16,18,29,20],implicit:8,remark:[33,10,28],talent:2,convers:10,musser:16,larger:[28,30],technolog:[13,1],makeb:37,orgpattern:28,scatter:28,staticmethod:[22,18,4,6,37,8],earli:[13,19,10,1],nameless:10,ratcanmov:36,evalrock:23,chanc:11,boxi:18,win:[32,10,23],app:29,foundat:[9,18,24],"_updat":6,pyton:10,expect:[21,10,28,23,33,19,8],hennei:21,"boolean":[10,28,12,36],notenough:12,limb:8,newimp:35,puriti:10,fee:10,from:[0,1,2,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22,23,28,29,31,32,33,35,36,37,38],sysconf:31,zip:[7,6],commun:[2,10,36],doubl:[9,10,32,28,4,33,23,22],addtrash:28,whatihave3:37,next:[10,11,1,12,4,16,28,18,22,36],implic:20,few:[5,20],camera:2,usr:[7,1],stage:[21,28,20],remaind:[7,9,28,14],sort:[21,33,10,11,28,16,18],clever:[21,18],src:7,trait:18,tplus1:8,impress:[10,28],train:2,bufferedread:36,iii:[9,26],starter:36,account:[7,1,20],chdir:1,retriev:[],when:[21,10,11,1,12,2,32,37,4,23,33,19,35,36,18,7,29,28,8,20],critic:10,thin:4,seqnum:20,meet:[32,28,12],fetch:[28,29],aquamac:7,proof:28,control:[21,9,10,11,29,12,13,4,33,28,35,7,22],cafemochawet:20,process:[21,33,10,0,1,12,13,4,23,16,28,11,18,7,8,20],lock:[2,8],high:[21,28],tag:[13,4,12],trashvisitor:28,csum:28,onlin:[13,29,18],kevlin:21,delai:[10,12],friendlier:7,comedi:33,georg:7,shapenamegen:4,sig:10,feta:20,subdirectori:[28,10,1,6],instead:[21,10,11,1,12,4,23,28,18,7,29,8,20],sin:10,stock:7,everywher:18,overridden:[33,28,0,1,12],singular:18,pyarrai:10,hazard:11,callback:[28,11,29],rmtree:6,multipl:[9,10,11,29,13,32,28,23,33,6,18,7,22],"120dpi":7,cheaper:21,physic:36,alloc:1,drop:28,essenti:[21,28,11,1,10,33],seriou:[33,1],newvsinit:18,correspond:[28,5,1,20],element:[21,10,1,12,28,33,6,18,8],issu:[13,21,28,22,18],allow:[21,10,11,30,12,32,4,28,0,18,29,8,35],subtyp:[28,18],horizdir:36,espressodecor:20,insight:[21,28],cleverdevil:18,evolutionari:28,comma:33,ponder:21,perfect:[2,13,28,21],outer:[22,10,37,1,29],chosen:[2,29,18],settitl:29,gnomesandfairi:4,newsgroup:7,repetet:18,decaf:20,criterion:29,tst:1,typemap:28,rat:[9,36],factor:[21,33,10,1],greater:10,"__getitem__":10,handl:[21,33,28,0,14],auto:[7,6],spell:2,dai:[2,10,18],ctor:28,devel:7,dat:28,mention:[2,28,11,1,4],snake:33,front:[9,35,20],mylist:18,strive:28,multiprocess:3,somewher:[7,4,29],anyth:[21,10,1,29,2,28,13,8],edit:[9,28,16,33,18,7],tran:12,quest:21,mode:[2,7,10,6],isclass:6,batch:33,reserv:1,newtonsmethod:11,psum:28,flair:13,subset:[28,20],chung:22,tolist:10,spoken:28,transitionb:12,transitionc:12,nodecor:20,"static":[21,9,10,1,12,4,33,28,6,18,22,37,20],"_delta":6,whet:21,our:[10,8,28,18],patch:[7,29],transitiont:12,special:[28,10,4,33,35,18,7],out:[21,9,10,28,1,12,31,2,29,4,23,33,13,18,7,22,8,19],variabl:[7,33,22,12],matt:8,contigu:29,cwr:36,dongwoo:7,hive:22,categori:[21,8,29],texliv:7,suitabl:10,rel:28,merg:[7,9,14],metaclass:[9,22,8,18],clone:[7,28],red:[29,18,36],clarifi:2,insid:[10,1,12,4,33,28,37,7,29,8],sortintobin:28,manipul:[16,10,18],standalon:7,dictionari:[10,37,12,4,23,33,5,18,14],tempt:35,releas:[29,1,12],embarrass:1,philip:20,indent:[13,33,6],could:[21,10,11,1,12,2,29,4,33,28,35,5,22],ask:[21,10,29,4,16,28,36,7,20],membership:28,david:[21,33,18],length:[28,12,1,29,13,10,36],enforc:1,outsid:[33,28,10,4],distinguish:[28,10,14,1],south:36,os_walk_comprehens:6,getclass:[16,32,10,28,12],qualiti:[21,1],scene:35,echo:[],all_slot:6,date:[10,18],set:[9,10,0,1,12,2,29,4,23,33,28,11,6,18,7,22,37,8,20],flyweight:12,newsingleton:22,facil:2,redund:11,cafemochaextraespressowhip:20,prioriti:7,"long":[10,28,2,4,33,13,35,7,22,8,20],start:[21,9,10,0,1,29,31,2,28,23,13,18,7,22,8,36],unknown:[28,23],licens:[2,9,10,22,17],isassignablefrom:1,mkdir:10,system:[21,10,11,1,12,31,2,32,15,4,23,13,18,7,28,36,19],wrapper:[10,28],cleverli:13,which:[0,1,2,3,4,5,6,7,8,10,11,12,13,15,16,18,20,21,28,23,22,29,32,33,35,36],termin:[33,11,1,36],prong:28,shell:[7,33,10],rsa:7,exit_on_clos:[10,29],slider:4,rst:[2,7,14,6],exactli:[33,10,28,20],readlinelib:10,haven:[13,28],priveledg:[],cpython:10,embodi:21,split:[29,6,18],see:[0,1,2,4,6,7,8,10,11,12,14,16,18,19,20,21,28,22,29,33,35,37,38],structur:[21,9,10,11,1,12,28,16,33,35,36,20],bee:[32,35,29],bind:[2,28,23],steer:36,imho:33,aggreg:28,isstat:1,clearli:[21,28,20,1,12],have:[0,1,2,4,6,7,8,10,11,12,13,15,16,17,18,19,20,21,28,23,22,29,30,32,33,35,37],cohes:[21,28],need:[0,1,2,4,5,7,8,10,11,13,14,17,18,20,21,28,23,22,29,30,32,33,35,37],north:36,turn:[21,10,1,12,2,28,33,35,36,29,14,20],gentli:8,lightgrai:[36,29],smallest:[28,20],min:29,rout:21,rmic:35,mix:28,discret:10,sei:1,frontmatt:14,linda:16,tymciurak:7,uppercas:0,entry_exit:8,unless:[2,33,35,1,6],clash:28,awt:10,minimasolv:11,discov:[21,9,28,1,31,13,4,7],rigor:[33,1],textui:[],mactex:7,why:[21,33,28,8,18],changealgorithm:11,wikic:28,gather:21,stronger:33,face:28,inde:[28,10,22,8,1],"__slots__":18,bui:2,michel:[8,18],determin:[33,28,11,12,4,23,16,36],gettotalcost:20,occasion:1,constrain:1,inexpens:28,gain:[2,18],statemachine2:12,dbm:12,mainloop:29,bring:[21,10,2,28,33,8,36],debat:13,trivial:[28,10,1,12],anywai:[13,33,11],pythoncardprototyp:29,redirect:[22,10,1],textual:29,locat:[10,11,1,12,28,7,14],nois:1,createbox:29,hadn:12,winner:32,jar:10,mug:20,should:[21,33,10,11,1,12,13,3,4,16,28,36,18,7,29,8,20],restructur:[2,7,6,13,9],suppos:[28,1,29,10,4,33,8],esqu:33,disciplin:8,inhabit:32,local:[21,28,29,2,33,18,7,20],hope:[21,14,17],move:[21,10,11,1,12,2,28,13,36,7,29,14,30],contribut:[2,7,30,13,9],espinc:28,ludicr:28,familiar:[7,16,28],disagre:6,autom:[10,1,12,13,15,28,18],regularli:[28,20],piecewis:11,bean:10,increas:1,applicationframework:0,triangl:4,extract:[28,10,1,6],enabl:[10,8],organ:[21,28,1,2,18,7],bisect:11,coplien:[28,11],mertz:18,grai:29,whatiuse2:37,integr:[33,28,11,1,29],contain:[21,9,10,29,12,4,33,16,28,6,37,7,22],grab:28,ddglass:28,view:[13,29],conform:20,"0079e10c":22,frame:[10,36],knowledg:[33,1,4],popen2:31,ebi:20,displai:[33,10,8,1,6],temporarili:10,troubl:[7,33,10],py2int:10,syntact:32,polymorph:[9,28,32,4,23,33],statu:28,error:[10,1,12,13,28,6,18,29],dlg:10,correctli:[7,1],pattern:[21,9,10,11,1,12,32,29,4,33,16,28,26,6,37,7,22,8,20,35],boundari:[7,10],misus:[21,28],tend:[21,33,28,1,18],favor:21,written:[33,29,11,1,18],"__bases__":18,japplet:0,progress:[7,8,14],bunch:28,email:[7,21],pazzaglia:16,bed:29,kei:[28,12,32,10,23,33,37,7,20],p2j:10,itertool:[27,9],job:[2,33,28,0],entir:[21,10,29,28,33,8],cafelattedecafwhip:20,addit:[10,1,12,2,28,33,35,18,7,29,8],exclaim:33,boxheight:29,admin:13,invulner:28,loveandtheft:8,etc:[28,0,2,4,23,33,19,11,7,8,20],admit:[21,28],succeed:11,equat:8,section:[21,10,32,28,4,34,37,7,14],freeli:[16,10,1],comment:[7,33,10,1],make_fil:6,interp2:10,"0076c54c":22,simpleclass:33,wall:36,guidelin:[13,33,28],arriv:28,chmod:10,walk:[21,10,1,6],vend:[9,12],incess:30,respect:28,labor:21,quit:[10,1,12,13,4,33,18,8,20],addmouselisten:29,htmldiff:6,decent:21,compos:33,compon:[16,29,10,28,20],treat:[28,10,1,12],nextto:29,immedi:[28,8,1,36,4],inneradapt:37,bulk:[13,28],espressoconpanna:20,togeth:[10,11,28,33,35,37],present:[21,28,1,12,10,37,20],multi:12,main:[10,0,1,29,2,28,33,7,36],plain:[7,20],align:33,harder:10,defin:[21,33,10,0,1,12,29,4,16,28,5,18,22,8,20],aarrgggh:36,decept:10,ill:28,cafemocha:20,htmlbutton:10,layer:[21,20],almost:[21,10,29,32,33,8],site:[2,28,11],motiv:[2,9,10,21,1],prose:13,incom:2,revis:28,cafemochadecaf:20,whatihav:37,bolder:1,mousemovelist:12,began:[21,1],classpath:[33,10,1],cross:[2,13,10],member:[28,1,29,2,32,23],python:[1,2,4,6,7,8,9,10,11,12,13,14,15,18,19,20,21,28,23,22,30,29,31,33,34,35],tendenc:28,fill:[10,28],infer:33,difficult:[21,10,12,2,28,33,20],competit:29,detect_cpu:31,original_new:22,denot:33,expans:[10,12],drink:20,upon:[32,10,8,28,18],effect:[28,11,1,12,29,4,23,18,22,37,20],coffe:[9,20],handi:29,issuccess:11,tribut:23,pdf:[2,7,13,9],canva:36,php:29,misappl:28,pull:[7,28,10,14,6],closenotifi:29,center:10,albin:28,firstli:20,weapon:32,nonetheless:8,well:[21,10,1,29,2,28,13,5,36,18,8,20],difflib:6,numerical_integr:11,thought:[21,28,11,30,22,16],scissor:23,weblog:[8,18],exampl:[0,1,2,4,6,7,8,9,10,11,12,13,14,18,20,21,28,23,22,30,29,32,33,35,36,37,38],command:[9,10,0,1,15,33,11,6,7],setq:7,choos:[9,10,11,1,2,4,28,18,7,14,20],breaker:21,usual:[21,10,0,1,28,33,5,18,8],test1:[10,1],run_ev:18,ccolor:29,test2:[10,1],test4:10,flesh:10,hybrid:10,heavili:[16,28],skill:11,simultan:[7,28],gliffi:13,web:[2,33,20],penchant:33,newbrain:11,field:[9,10,1,12,13,33,18,29],bell:[10,28,18],makefil:[10,14,1,30],knew:[1,18],proxydemo2:35,add:[1,2,4,6,7,8,10,11,12,13,14,15,17,18,20,21,28,23,22,29,32,33,35,36],jython_hom:10,wet:20,collis:36,ought:12,match:[32,28,11,23,29],confront:22,jython:[9,10,14,18],royalti:[2,10],elementat:36,fate:28,sumvalu:28,caller:[28,4,18],piec:[21,22,28,6],arguabl:[10,28],testa:1,camelcas:13,testb:1,know:[10,1,29,2,8,28,23,13,7,14],press:[33,10],redesign:28,height:[36,29],recurs:[28,11,4],insert:[33,22,28,6,18],trash:[21,9,28],resid:33,like:[1,2,4,7,8,10,11,12,13,16,17,18,20,21,23,28,30,29,32,33,35,36],lost:[10,28],incred:33,paperbin:28,necessari:[28,0,1,12,10,33,35,37,7],martin:[28,8],resiz:[33,0],boxdesc:29,page:[7,9,11,8,33],poor:28,sum:[33,28],trashbin:28,captur:[10,8],suppli:10,phenomena:29,cafemochaextraespresso:20,growth:20,"export":[7,10],superclass:10,flush:1,proper:[10,28,12],home:[7,10],peter:29,simple1:18,librari:[9,10,11,1,29,31,37,16,33,5,18],simple2:[33,18],tmp:1,"__setattr__":22,trust:1,leaf:18,lead:21,developerguid:14,avoid:[7,21,28],doublevalu:28,slide:17,overlap:29,jeremi:36,itemnotavail:12,troup:33,getnam:[28,1],trap:12,hinder:33,weslei:[28,11],slower:[21,10],investig:36,usag:[21,9,28,1],facilit:[28,29],host:[2,7],arg1:[33,8],although:[21,10,28,1,2,4,13,5,7,8],offset:29,beneath:0,panel:29,about:[21,9,10,28,1,12,31,2,8,4,23,16,13,36,18,7,37,14,20,33],quarter:12,rare:21,column:29,purist:28,javaclass:10,mindviewinc:[],bridg:10,constructor:[9,10,0,1,12,29,4,33,28,18,22,8],wxcommandev:29,"0076b7ac":22,own:[21,10,29,1,12,2,15,4,23,33,28,34,35,6,18,7,22,14,20,36],absolut:33,fillov:36,bashrc:10,automat:[9,10,11,1,12,13,15,4,33,28,35,5,6,18,7,29,37,30],guard:21,getpric:12,awhil:21,rectifi:[28,8],pitfal:33,forget:28,mere:10,leverag:[10,18],prozac:12,val:[33,22,10,28,29],transfer:[9,5,12],inner:[9,10,1,29,28,37,38,22,8],transitiona:12,maze:[9,36],stai:[21,28,11],arg2:[33,8],"function":[9,10,11,1,12,33,3,29,4,23,16,28,5,18,32,7,22,8],mailer:7,imatix:12,pythontojavaclass:10,subscrib:21,triangular:18,bodi:[33,28,11,8],measur:13,kungfugui:4,highest:7,eat:32,count:[33,1,12],made:[28,30,12,13,10,18,29],cleanup:1,newval:28,whether:[28,11,29,12,2,10,18,36],wish:[10,1,20],scroll:10,dynatrash:28,distract:10,record:36,below:[7,10,11,29,20],limit:[33,10,8,22,18],testfil:6,trepid:8,otherwis:[21,28,11,1,29,2,18],problem:[21,33,10,11,1,12,3,29,4,23,16,28,35,18,32,22,37,8,20],jdialog:10,evalu:12,"int":[28,12,1,29,31,10,14,36],rather:[33,10,1,29,31,13,32,4,16,28,35,18,37,8,20],dure:[10,1,12,2,28,16,35,8],twist:28,implement:[21,9,10,11,1,12,32,4,33,28,35,36,18,29,37,8,20],decorator_function_with_argu:8,ing:18,eric:[35,29],probabl:[21,10,11,29,13,28,23,33,35,5,18,8],typemapadapt:28,inevit:28,entry_exit_funct:8,detail:[21,9,28,11,29,31,32,22,7],virtual:[28,0,12,32,4,33,35,7],preinstal:7,book:[21,9,28,0,1,2,8,4,33,13,11,17,18,32,7,22,37,14,36,19],lookup:[32,23],futur:[2,10],rememb:[33,10,28,23],bazzar:13,repeat:[21,11,29,4,7,20],star:22,fulli:33,multipledispatch:23,cafelatteextraespressowhip:20,singleton:[21,9,22,37,12,33,18],lightoff:[10,18],vein:8,typenum:28,experienc:33,sphinx:[9,30,2,13,7,14],interp1:10,came:[16,21,28],indirectli:28,rule:[21,9,10,1,13,33],getreturntyp:1,portion:1,klass:[22,29,18],cookbook:18},titles:["Building Application Frameworks","Unit Testing & Test-Driven Development","Introduction","Coroutines & Concurrency","Factory: Encapsulating Object Creation","Messenger/Data Transfer Object","Comprehensions","Developer Guide","Decorators","Python 3 Patterns, Recipes and Idioms","Jython","Function Objects","StateMachine","Book Development Rules","ToDo List","A Canonical Form for Command-Line Programs","Iterators: Decoupling Algorithms from Containers","Teaching Support","Metaclasses","A Note To Readers","Decorator: Dynamic Type Selection","The Pattern Concept","The Singleton","Multiple Dispatching","Part I: Foundations","Part II: Idioms","Part III: Patterns","Generators, Iterators, and Itertools","Pattern Refactoring","Observer","Contributors","Discovering the Details About Your Platform","Visitor","Quick Python for Programmers","Python 3 Language Changes","Fronting for an Implementation","Projects","Changing the Interface","Table-Driven Code: Configuration Flexibility"],modules:{},descrefs:{},filenames:["AppFrameworks","UnitTesting","Introduction","CoroutinesAndConcurrency","Factory","Messenger","Comprehensions","DeveloperGuide","PythonDecorators","index","Jython","FunctionObjects","StateMachine","Rules","ToDo","CanonicalScript","Iterators","TeachingSupport","Metaclasses","NoteToReaders","Decorator","PatternConcept","Singleton","MultipleDispatching","Part1","Part2","Part3","GeneratorsIterators","PatternRefactoring","Observer","Contributors","MachineDiscovery","Visitor","QuickPython","LanguageChanges","Fronting","Projects","ChangeInterface","TableDriven"]}) |
Up to file-list src/Decorator.rst:
| … | … | @@ -354,6 +354,14 @@ the price of milk goes up? Having a clas |
354 |
354 |
need to change a method in each class, and thus maintain many classes. By using |
355 |
355 |
decorators, maintenance is reduced by defining the logic in one place. |
356 |
356 |
|
357 |
Further Reading |
|
358 |
======================================================================= |
|
359 |
||
360 |
Philip Eby introduces decorators: http://www.ddj.com/web-development/184406073 |
|
361 |
||
362 |
Class Decorators: |
|
363 |
- http://www.informit.com/articles/article.aspx?p=1309289&seqNum=4 |
|
364 |
||
357 |
365 |
Exercises |
358 |
366 |
======================================================================= |
359 |
367 |
Up to file-list src/Metaclasses.rst:
| … | … | @@ -627,7 +627,76 @@ version. Because of this behavior, each |
627 |
627 |
class-specific ``instance`` field (thus ``instance`` is not somehow |
628 |
628 |
being "inherited" from the metaclass). |
629 |
629 |
|
630 |
.. class decorator version that modifies __new__(). |
|
630 |
A Class Decorator Singleton |
|
631 |
-------------------------------------------------------------------------------- |
|
632 |
||
633 |
:: |
|
634 |
||
635 |
# Metaclasses/SingletonDecorator.py |
|
636 |
||
637 |
def singleton(klass): |
|
638 |
"Simple replacement of object creation operation" |
|
639 |
def getinstance(*args, **kw): |
|
640 |
if not hasattr(klass, 'instance'): |
|
641 |
klass.instance = klass(*args, **kw) |
|
642 |
return klass.instance |
|
643 |
return getinstance |
|
644 |
||
645 |
def singleton(klass): |
|
646 |
""" |
|
647 |
More powerful approach: Change the behavior |
|
648 |
of the instances AND the class object. |
|
649 |
""" |
|
650 |
class Decorated(klass): |
|
651 |
def __init__(self, *args, **kwargs): |
|
652 |
if hasattr(klass, '__init__'): |
|
653 |
klass.__init__(self, *args, **kwargs) |
|
654 |
def __repr__(self) : return klass.__name__ + " obj" |
|
655 |
__str__ = __repr__ |
|
656 |
Decorated.__name__ = klass.__name__ |
|
657 |
class ClassObject: |
|
658 |
def __init__(cls): |
|
659 |
cls.instance = None |
|
660 |
def __repr__(cls): |
|
661 |
return klass.__name__ |
|
662 |
__str__ = __repr__ |
|
663 |
def __call__(cls, *args, **kwargs): |
|
664 |
print str(cls) + " __call__ " |
|
665 |
if not cls.instance: |
|
666 |
cls.instance = Decorated(*args, **kwargs) |
|
667 |
return cls.instance |
|
668 |
return ClassObject() |
|
669 |
||
670 |
@singleton |
|
671 |
class ASingleton: pass |
|
672 |
||
673 |
a = ASingleton() |
|
674 |
b = ASingleton() |
|
675 |
print(a, b) |
|
676 |
print a.__class__.__name__ |
|
677 |
print ASingleton |
|
678 |
assert a is b |
|
679 |
||
680 |
@singleton |
|
681 |
class BSingleton: |
|
682 |
def __init__(self, x): |
|
683 |
self.x = x |
|
684 |
||
685 |
c = BSingleton(11) |
|
686 |
d = BSingleton(22) |
|
687 |
assert c is d |
|
688 |
assert c is not a |
|
689 |
||
690 |
""" Output: |
|
691 |
ASingleton __call__ |
|
692 |
ASingleton __call__ |
|
693 |
(ASingleton obj, ASingleton obj) |
|
694 |
ASingleton |
|
695 |
ASingleton |
|
696 |
BSingleton __call__ |
|
697 |
BSingleton __call__ |
|
698 |
""" |
|
699 |
||
631 |
700 |
|
632 |
701 |
Metaclass Conflicts |
633 |
702 |
================================================================================ |
Up to file-list src/PatternConcept.rst:
| … | … | @@ -257,6 +257,12 @@ handful of fundamental ideas that can be |
257 |
257 |
problem. However, other ideas that come from this list may end up being useful |
258 |
258 |
as a checklist while walking through and analyzing your design. |
259 |
259 |
|
260 |
Further Reading |
|
261 |
================================================================================== |
|
262 |
||
263 |
Alex Martelli's Video Lectures on Design Patterns in Python: |
|
264 |
http://www.catonmat.net/blog/learning-python-design-patterns-through-video-lectures/ |
|
265 |
||
260 |
266 |
.. rubric:: Footnotes |
261 |
267 |
|
262 |
268 |
.. [#] From Mark Johnson. |
Up to file-list src/QuickPython.rst:
| … | … | @@ -490,4 +490,10 @@ Useful Techniques |
490 |
490 |
|
491 |
491 |
.. note:: Suggest Further Topics for inclusion in the introductory chapter |
492 |
492 |
|
493 |
Further Reading |
|
494 |
=========================================================================== |
|
493 |
495 |
|
496 |
Python Programming FAQ: |
|
497 |
http://www.python.org/doc/faq/programming/ |
|
498 |
||
499 |
