Popular recipes tagged "object" but not "oriented"http://code.activestate.com/recipes/tags/object-oriented/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> 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> CLOS-like around/before/after auxiliary methods (Python) 2011-08-25T22:59:22-07:00Jan Kaliszewskihttp://code.activestate.com/recipes/users/4172762/http://code.activestate.com/recipes/577859-clos-like-aroundbeforeafter-auxiliary-methods/ <p style="color: grey"> Python recipe 577859 by <a href="/recipes/users/4172762/">Jan Kaliszewski</a> (<a href="/recipes/tags/auxiliary/">auxiliary</a>, <a href="/recipes/tags/class/">class</a>, <a href="/recipes/tags/clos/">clos</a>, <a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/inheritance/">inheritance</a>, <a href="/recipes/tags/method/">method</a>, <a href="/recipes/tags/object/">object</a>, <a href="/recipes/tags/super/">super</a>). </p> <p>This module provides an easy way to define and use your own <strong>around/before/after auxiliary methods</strong>, similar to <a href="http://www.aiai.ed.ac.uk/~jeff/clos-guide.html#meth-comb">those used in CLOS</a> (Common Lisp Object System).</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> Object Wrapper (Python) 2010-05-05T17:02:42-07:00Dmitryhttp://code.activestate.com/recipes/users/4173772/http://code.activestate.com/recipes/577215-object-wrapper/ <p style="color: grey"> Python recipe 577215 by <a href="/recipes/users/4173772/">Dmitry</a> (<a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/object/">object</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). </p> <p>There is classical wrapper on Python language. If you have only object and can't change object generation you can use this class.</p>