Top-rated recipes tagged "traits"http://code.activestate.com/recipes/tags/traits/top/2014-12-03T09:55:06-08:00ActiveState Code RecipesEasy attribute setting and pretty representation (Python) 2014-12-03T09:55:06-08:00Joakim Petterssonhttp://code.activestate.com/recipes/users/4174760/http://code.activestate.com/recipes/578973-easy-attribute-setting-and-pretty-representation/ <p style="color: grey"> Python recipe 578973 by <a href="/recipes/users/4174760/">Joakim Pettersson</a> (<a href="/recipes/tags/attributes/">attributes</a>, <a href="/recipes/tags/lazy/">lazy</a>, <a href="/recipes/tags/traits/">traits</a>). Revision 2. </p> <p>Mix in one or more of these classes to avoid those tedious lines of administrative code for setting attributes and getting useful representations. </p> <p>If you inherit HasInitableAttributes, your should be able to obj = eval(repr(obj)) without loosing data.</p> <p>enthought.traits.api.HasTraits seems to mix in well also.</p>