Most viewed recipes tagged "constants"http://code.activestate.com/recipes/tags/constants/views/2011-08-12T23:21:32-07:00ActiveState Code RecipesSimple but Powerful Grouped Constants -- A Step Toward NamedConstants (Python) 2011-08-12T23:21:32-07:00Eric Snowhttp://code.activestate.com/recipes/users/4177816/http://code.activestate.com/recipes/577755-simple-but-powerful-grouped-constants-a-step-towar/ <p style="color: grey"> Python recipe 577755 by <a href="/recipes/users/4177816/">Eric Snow</a> (<a href="/recipes/tags/constants/">constants</a>). Revision 6. </p> <p>The recipe provides an easy-to-use class for a group of "constants". It provides helper functions for getting the constant values just right. It also exposes the mechanism it uses to bind the contents of an iterable into the namespace of another object.</p> <p>For this binding and for the grouped constants, this recipe makes it easy to dynamically generate the mapped values you want to expose.</p> <p>The next step is to make the values aware of the context in which they are bound and to strengthen their association with the group they are in. And that is one of the recipes I'm working on next!</p> Auto Named Decriptors (Python) 2010-10-19T22:55:16-07:00Aloys Baillethttp://code.activestate.com/recipes/users/4175355/http://code.activestate.com/recipes/577426-auto-named-decriptors/ <p style="color: grey"> Python recipe 577426 by <a href="/recipes/users/4175355/">Aloys Baillet</a> (<a href="/recipes/tags/automatically/">automatically</a>, <a href="/recipes/tags/constants/">constants</a>, <a href="/recipes/tags/descriptors/">descriptors</a>, <a href="/recipes/tags/metaclass/">metaclass</a>, <a href="/recipes/tags/name/">name</a>, <a href="/recipes/tags/string/">string</a>). Revision 3. </p> <p>Using named Descriptors? Tired of duplicating the name of the instance in a string? A small metaclass can solve this.</p>