Popular recipes tagged "object" but not "decorator" and "directed"http://code.activestate.com/recipes/tags/-decorator+object-directed/2016-02-25T19:40:33-08:00ActiveState Code RecipesPython method chaining examples (Python)
2016-02-25T19:40:33-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580616-python-method-chaining-examples/
<p style="color: grey">
Python
recipe 580616
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/chaining/">chaining</a>, <a href="/recipes/tags/methods/">methods</a>, <a href="/recipes/tags/object/">object</a>, <a href="/recipes/tags/oop/">oop</a>, <a href="/recipes/tags/python/">python</a>).
</p>
<p>This recipe shows a few examples of doing method chaining in Python.</p>
Simple tool for simulating classes using closures and nested scopes (Python)
2012-04-11T06:21:18-07:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/578091-simple-tool-for-simulating-classes-using-closures-/
<p style="color: grey">
Python
recipe 578091
by <a href="/recipes/users/178123/">Raymond Hettinger</a>
(<a href="/recipes/tags/closure/">closure</a>, <a href="/recipes/tags/object/">object</a>, <a href="/recipes/tags/oriented/">oriented</a>).
Revision 9.
</p>
<p>Closured-based alternative to normal classes. Allows a faster, cleaner coding style at the expense of some functionality.</p>
A Simpler Namespace Class (Python)
2013-02-14T17:42:24-08:00Eric Snowhttp://code.activestate.com/recipes/users/4177816/http://code.activestate.com/recipes/578141-a-simpler-namespace-class/
<p style="color: grey">
Python
recipe 578141
by <a href="/recipes/users/4177816/">Eric Snow</a>
(<a href="/recipes/tags/namespaces/">namespaces</a>, <a href="/recipes/tags/object/">object</a>).
Revision 3.
</p>
<p>A very simple, attribute-based namespace type (and one offspring). Everyone's written one of these...</p>
extending xrange to support slicing and indexing (Python)
2012-03-13T16:13:16-07:00Garretthttp://code.activestate.com/recipes/users/4181290/http://code.activestate.com/recipes/578070-extending-xrange-to-support-slicing-and-indexing/
<p style="color: grey">
Python
recipe 578070
by <a href="/recipes/users/4181290/">Garrett</a>
(<a href="/recipes/tags/object/">object</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/xrange/">xrange</a>).
</p>
<p>an object which extends the xrange object to support slicing and indexing (simple)</p>
XML To Python object(next generation) with real life example: fetching US Treasure Curve (Python)
2012-02-14T01:24:28-08:00Boris Katshttp://code.activestate.com/recipes/users/4180778/http://code.activestate.com/recipes/578032-xml-to-python-objectnext-generation-with-real-life/
<p style="color: grey">
Python
recipe 578032
by <a href="/recipes/users/4180778/">Boris Kats</a>
(<a href="/recipes/tags/object/">object</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/xml/">xml</a>).
Revision 11.
</p>
<p>This middle sized python class will populate himself from any xml with reasonable restrictions.</p>
Fnct.D, comprehensive Bash-shell coding scheme. (Bash)
2010-11-01T00:29:09-07:00Patrick Riendeauhttp://code.activestate.com/recipes/users/4175653/http://code.activestate.com/recipes/577446-fnctd-comprehensive-bash-shell-coding-scheme/
<p style="color: grey">
Bash
recipe 577446
by <a href="/recipes/users/4175653/">Patrick Riendeau</a>
(<a href="/recipes/tags/bash/">bash</a>, <a href="/recipes/tags/object/">object</a>, <a href="/recipes/tags/oop/">oop</a>, <a href="/recipes/tags/oriented/">oriented</a>, <a href="/recipes/tags/shell/">shell</a>, <a href="/recipes/tags/system/">system</a>).
</p>
<p>A Bash compromising shell-module to pre-introduce object-oriented Bash-code.</p>
Object snoop - experiment with Python special methods (Python)
2010-09-05T17:54:50-07:00Wai Yip Tunghttp://code.activestate.com/recipes/users/2382677/http://code.activestate.com/recipes/577383-object-snoop-experiment-with-python-special-method/
<p style="color: grey">
Python
recipe 577383
by <a href="/recipes/users/2382677/">Wai Yip Tung</a>
(<a href="/recipes/tags/metaprogramming/">metaprogramming</a>, <a href="/recipes/tags/methods/">methods</a>, <a href="/recipes/tags/object/">object</a>).
</p>
<p>In Python, classes can define their own behavior with respect to language operators. For example, if a class defines __getitem__(), then x[i], where x is an instance of the clas, will be execute by a call to x.__getitem__(i).</p>
<p>While Python has an extensive documentation on the special methods, reading a specification may not be the best way to reveal the intricate details. <strong>object_snoop</strong> allows user to observe how Python expressions and statements are translated into special method calls. object_snoop defines most special methods. It simple print a trace and returns a fixed but sensible result. Users are invited to build complex expressions to experiment how Python special methods work.</p>
Immutable object(subclass) (Python)
2010-04-23T08:30:50-07:00Dmitryhttp://code.activestate.com/recipes/users/4173772/http://code.activestate.com/recipes/577207-immutable-objectsubclass/
<p style="color: grey">
Python
recipe 577207
by <a href="/recipes/users/4173772/">Dmitry</a>
(<a href="/recipes/tags/immutable/">immutable</a>, <a href="/recipes/tags/object/">object</a>).
Revision 2.
</p>
<p>Useful class and decorator for create immutable objects. Decorator mutablemethod used for define mutable methods.</p>