Popular recipes tagged "property_creation" but not "code"http://code.activestate.com/recipes/tags/property_creation-code/2010-12-01T17:22:49-08:00ActiveState Code RecipesEasy 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>