Popular recipes tagged "property" but not "programs"http://code.activestate.com/recipes/tags/property-programs/2012-05-09T23:24:55-07:00ActiveState Code RecipesItem Properties (Python) 2012-05-09T23:24:55-07:00Ian Kellyhttp://code.activestate.com/recipes/users/4178016/http://code.activestate.com/recipes/577703-item-properties/ <p style="color: grey"> Python recipe 577703 by <a href="/recipes/users/4178016/">Ian Kelly</a> (<a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/descriptor/">descriptor</a>, <a href="/recipes/tags/oop/">oop</a>, <a href="/recipes/tags/property/">property</a>). Revision 2. </p> <p>A property variation that allows property access using an index or key.</p> Attribute - easy way to define interface (Python) 2011-03-06T12:49:30-08:00ilon asolothttp://code.activestate.com/recipes/users/4177080/http://code.activestate.com/recipes/577598-attribute-easy-way-to-define-interface/ <p style="color: grey"> Python recipe 577598 by <a href="/recipes/users/4177080/">ilon asolot</a> (<a href="/recipes/tags/attribute/">attribute</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/property/">property</a>, <a href="/recipes/tags/python/">python</a>). </p> <p>it is an enhanced property</p> <pre class="prettyprint"><code> * initialize attribute in class definition scope * easily keep the attribute behaviors in sub classes. * easy to define interface. * not afraid to forget the super(klass, self).__init__(...) :P </code></pre> Attribute - easy way to define interface (Python) 2011-02-20T16:31:08-08:00Hui Zhanghttp://code.activestate.com/recipes/users/4177055/http://code.activestate.com/recipes/577579-attribute-easy-way-to-define-interface/ <p style="color: grey"> Python recipe 577579 by <a href="/recipes/users/4177055/">Hui Zhang</a> (<a href="/recipes/tags/attribute/">attribute</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/property/">property</a>, <a href="/recipes/tags/python/">python</a>). Revision 2. </p> <p>it is an enhanced property</p> <pre class="prettyprint"><code> * initialize attribute in class definition scope * easily keep the attribute behaviors in sub classes. * easy to define interface. * not afraid to forget the super(klass, self).__init__(...) :P </code></pre> Convert PyQt properties to Python properties (Python) 2011-01-09T02:02:30-08:00Miguel Turnerhttp://code.activestate.com/recipes/users/4176460/http://code.activestate.com/recipes/577539-convert-pyqt-properties-to-python-properties/ <p style="color: grey"> Python recipe 577539 by <a href="/recipes/users/4176460/">Miguel Turner</a> (<a href="/recipes/tags/property/">property</a>, <a href="/recipes/tags/pyqt/">pyqt</a>, <a href="/recipes/tags/pyside/">pyside</a>, <a href="/recipes/tags/python/">python</a>). Revision 2. </p> <p>This recipe will find all attributes created as meta-object properties in Qt and will create a Python property of the same name for each of them. This is a quick way of providing some of the functionality suggested by <a href="http://www.pyside.org/docs/pseps/psep-0102.html">PSEP 102</a>, which I sincerely hope will be accepted, as it will make PySide considerably more pythonic.</p> Easy property creation and control (Python) 2010-12-01T17:22:49-08:00Kevin L. Sitzehttp://code.activestate.com/recipes/users/4173535/http://code.activestate.com/recipes/577482-easy-property-creation-and-control/ <p style="color: grey"> Python recipe 577482 by <a href="/recipes/users/4173535/">Kevin L. Sitze</a> (<a href="/recipes/tags/class/">class</a>, <a href="/recipes/tags/property/">property</a>, <a href="/recipes/tags/property_creation/">property_creation</a>, <a href="/recipes/tags/tools/">tools</a>, <a href="/recipes/tags/unittests/">unittests</a>). </p> <p>The Property class provides basic functionality that allows class level control over how a particular attribute is managed. In its simplest form a Property attribute works exactly like a regular attribute on an instance while providing documentation details about the attribute accessible via the declaring class.</p> Easy Property Creation in Python (Python) 2009-05-06T11:59:16-07:00runsun panhttp://code.activestate.com/recipes/users/2638612/http://code.activestate.com/recipes/576742-easy-property-creation-in-python/ <p style="color: grey"> Python recipe 576742 by <a href="/recipes/users/2638612/">runsun pan</a> (<a href="/recipes/tags/class/">class</a>, <a href="/recipes/tags/property/">property</a>, <a href="/recipes/tags/property_creation/">property_creation</a>). Revision 4. </p> <p>Presented in this recipe is a function <strong>prop</strong>, with that a property <em>myprop</em> can be created as simple as:</p> <pre class="prettyprint"><code>@prop def myprop(): pass </code></pre> <p>It has only 7 lines of code, easy to understand, easy to customize, will make the code look much netter and will save you a lot of typing.</p> <p>See discussion and the doc test string for more complicated usages.</p> <p>Note: This is a recipe created with python v.2.5.2.</p> Cached Property (Python) 2010-05-19T22:38:24-07:00Ken Seeharthttp://code.activestate.com/recipes/users/4167995/http://code.activestate.com/recipes/576563-cached-property/ <p style="color: grey"> Python recipe 576563 by <a href="/recipes/users/4167995/">Ken Seehart</a> (<a href="/recipes/tags/cache/">cache</a>, <a href="/recipes/tags/property/">property</a>). </p> <p>A cached property is a read-only property that is calculated on demand and automatically cached. If the value has already been calculated, the cached value is returned.</p> Property wrapper (Python) 2010-07-20T14:30:30-07:00Louis RIVIEREhttp://code.activestate.com/recipes/users/4035877/http://code.activestate.com/recipes/502243-property-wrapper/ <p style="color: grey"> Python recipe 502243 by <a href="/recipes/users/4035877/">Louis RIVIERE</a> (<a href="/recipes/tags/property/">property</a>, <a href="/recipes/tags/wrapper/">wrapper</a>). </p> <p>This property shortcut doesn't restrict the property's attributes to get, set, del and doc. Besides these functions can have any name, not limited to fget, fset ... Note that the default doc is not the getter's one.</p>