Popular recipes by Matthew Zipay http://code.activestate.com/recipes/users/4183355/2012-11-25T03:43:06-08:00ActiveState Code RecipesPseudoStruct (Python)
2012-11-25T03:43:06-08:00Matthew Zipayhttp://code.activestate.com/recipes/users/4183355/http://code.activestate.com/recipes/578349-pseudostruct/
<p style="color: grey">
Python
recipe 578349
by <a href="/recipes/users/4183355/">Matthew Zipay</a>
(<a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/namedtuple/">namedtuple</a>, <a href="/recipes/tags/record/">record</a>).
</p>
<p>This is a recipe for a Python "data object." It is similar in function to namedtuple (<a href="http://code.activestate.com/recipes/500261/" rel="nofollow">http://code.activestate.com/recipes/500261/</a>) and recordtype (<a href="http://code.activestate.com/recipes/576555-records/" rel="nofollow">http://code.activestate.com/recipes/576555-records/</a>) in that it is a simple container for data, but is designed to meet three specific goals:</p>
<ol>
<li>Easy to subclass data objects.</li>
<li>Get/set speed comparable to a simple class.</li>
<li>Minimal memory consumption per instance.</li>
</ol>