Top-rated recipes tagged "container"http://code.activestate.com/recipes/tags/container/top/2011-12-23T22:10:38-08:00ActiveState Code RecipesRecursively walk Python objects (Python) 2011-12-23T22:10:38-08:00Yaniv Akninhttp://code.activestate.com/recipes/users/4180246/http://code.activestate.com/recipes/577982-recursively-walk-python-objects/ <p style="color: grey"> Python recipe 577982 by <a href="/recipes/users/4180246/">Yaniv Aknin</a> (<a href="/recipes/tags/container/">container</a>, <a href="/recipes/tags/recursive/">recursive</a>, <a href="/recipes/tags/recursive_iterator/">recursive_iterator</a>, <a href="/recipes/tags/walk/">walk</a>). Revision 2. </p> <p>A small function that walks over pretty much any Python object and yields the objects contained within (if any) along with the path to reach them. I wrote it and am using it to validate a deserialized data-structure, but you can probably use it for many things.</p> Efficient Running Median using an Indexable Skiplist (Python) 2010-02-07T14:40:03-08:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/576930-efficient-running-median-using-an-indexable-skipli/ <p style="color: grey"> Python recipe 576930 by <a href="/recipes/users/178123/">Raymond Hettinger</a> (<a href="/recipes/tags/advanced_data_structure/">advanced_data_structure</a>, <a href="/recipes/tags/container/">container</a>, <a href="/recipes/tags/median/">median</a>, <a href="/recipes/tags/new_algorithm/">new_algorithm</a>, <a href="/recipes/tags/skiplist/">skiplist</a>, <a href="/recipes/tags/sliding_window/">sliding_window</a>). Revision 10. </p> <p>Maintains sorted data as new elements are added and old one removed as a sliding window advances over a stream of data. Also gives fast indexed access to value. Running time per median update is proportional to the log of the window size.</p> Minimal Dependency Injection Container (Python) 2010-06-05T13:50:03-07:00Alan Franzonihttp://code.activestate.com/recipes/users/4169882/http://code.activestate.com/recipes/577254-minimal-dependency-injection-container/ <p style="color: grey"> Python recipe 577254 by <a href="/recipes/users/4169882/">Alan Franzoni</a> (<a href="/recipes/tags/container/">container</a>, <a href="/recipes/tags/control/">control</a>, <a href="/recipes/tags/dependency/">dependency</a>, <a href="/recipes/tags/di/">di</a>, <a href="/recipes/tags/dic/">dic</a>, <a href="/recipes/tags/injection/">injection</a>, <a href="/recipes/tags/inversion/">inversion</a>, <a href="/recipes/tags/ioc/">ioc</a>, <a href="/recipes/tags/iocc/">iocc</a>). </p> <p>An example of a minimal dependency injection ( aka Inversion of Control ) container for Python.</p>