Popular recipes tagged "mutable"http://code.activestate.com/recipes/tags/mutable/2012-02-16T18:38:54-08:00ActiveState Code RecipesNamedList (Python) 2012-02-16T18:38:54-08:00Sergey Shepelevhttp://code.activestate.com/recipes/users/4180945/http://code.activestate.com/recipes/578041-namedlist/ <p style="color: grey"> Python recipe 578041 by <a href="/recipes/users/4180945/">Sergey Shepelev</a> (<a href="/recipes/tags/datastructures/">datastructures</a>, <a href="/recipes/tags/mutable/">mutable</a>). </p> <p>Fast lightweight attribute style access to list. I think this is closest to mutable C struct type.</p> <p>Same as collections.namedtuple but subclasses list, so fields may be modified. Same as popular Record class but smaller and faster. <a href="http://code.activestate.com/recipes/502237-simple-record-aka-struct-type/" rel="nofollow">http://code.activestate.com/recipes/502237-simple-record-aka-struct-type/</a></p> A Protocol for Making Objects Immutable (Python) 2011-10-07T03:59:45-07:00Eric Snowhttp://code.activestate.com/recipes/users/4177816/http://code.activestate.com/recipes/577895-a-protocol-for-making-objects-immutable/ <p style="color: grey"> Python recipe 577895 by <a href="/recipes/users/4177816/">Eric Snow</a> (<a href="/recipes/tags/freeze/">freeze</a>, <a href="/recipes/tags/immutable/">immutable</a>, <a href="/recipes/tags/mutable/">mutable</a>, <a href="/recipes/tags/unfreeze/">unfreeze</a>). </p> <p>Python already provides immutable versions of many of the mutable built-in types. Dict is the notable exception. Regardless, here is a protocol that objects may implement that facilitates turning immutable object mutable and vice-versa.</p>