Popular recipes tagged "nested" but not "introspection"http://code.activestate.com/recipes/tags/nested-introspection/2013-08-18T22:54:26-07:00ActiveState Code Recipeswrist friendly dictionary (Python)
2013-08-18T22:54:26-07:00Ariel Keselmanhttp://code.activestate.com/recipes/users/4187559/http://code.activestate.com/recipes/578644-wrist-friendly-dictionary/
<p style="color: grey">
Python
recipe 578644
by <a href="/recipes/users/4187559/">Ariel Keselman</a>
(<a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/interface/">interface</a>, <a href="/recipes/tags/nested/">nested</a>).
</p>
<p>this dictionary allows easy manual creation of nested hierarchies, like so:</p>
<p>window.style.width=5</p>
<p>or... </p>
<p>window['background-color'].rgb= 255,255,255</p>
Nested contexts -- a chain of mapping objects (Python)
2010-10-25T02:13:37-07:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/577434-nested-contexts-a-chain-of-mapping-objects/
<p style="color: grey">
Python
recipe 577434
by <a href="/recipes/users/178123/">Raymond Hettinger</a>
(<a href="/recipes/tags/ast/">ast</a>, <a href="/recipes/tags/chained/">chained</a>, <a href="/recipes/tags/compiler/">compiler</a>, <a href="/recipes/tags/dictionary/">dictionary</a>, <a href="/recipes/tags/inheritance/">inheritance</a>, <a href="/recipes/tags/nested/">nested</a>, <a href="/recipes/tags/nonlocal/">nonlocal</a>, <a href="/recipes/tags/scopes/">scopes</a>, <a href="/recipes/tags/xml/">xml</a>).
Revision 2.
</p>
<p>Easy to use chain of dictionaries for crafting nested scopes or for a tree of scopes. Useful for analyzing AST nodes, XML nodes or other structures with multiple scopes. Can emulate various chaining styles including static/lexical scoping, dynamic scoping and Python's own globals(), locals(), nested scopes, and writeable nonlocals. Can also model Python's inheritance chains: instance dictionary, class dictionary, and base classes.</p>
Easily Write Nested Loops (Python)
2012-02-18T01:34:55-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/578046-easily-write-nested-loops/
<p style="color: grey">
Python
recipe 578046
by <a href="/recipes/users/2608421/">Stephen Chappell</a>
(<a href="/recipes/tags/iteration/">iteration</a>, <a href="/recipes/tags/nested/">nested</a>).
</p>
<p>The "nest" generator function in this module is provided to make writing
nested loops easier to accomplish. Instead of writing a for loop at each
level, one may call "nest" with each sequence as an argument and receive
items from the sequences correctly yielded back to the caller. A test is
included at the bottom of this module to demonstrate how to use the code.</p>
Nest a flat list (Python)
2010-02-25T03:50:09-08:00Sander Evershttp://code.activestate.com/recipes/users/4173111/http://code.activestate.com/recipes/577061-nest-a-flat-list/
<p style="color: grey">
Python
recipe 577061
by <a href="/recipes/users/4173111/">Sander Evers</a>
(<a href="/recipes/tags/list/">list</a>, <a href="/recipes/tags/nest/">nest</a>, <a href="/recipes/tags/nested/">nested</a>, <a href="/recipes/tags/unflatten/">unflatten</a>).
Revision 2.
</p>
<p>Turn a flat list into a nested list, with a specified number of lists per nesting level.</p>
Flattened List (Python)
2009-04-27T18:41:21-07:00marlonamorhttp://code.activestate.com/recipes/users/4169863/http://code.activestate.com/recipes/576719-flattened-list/
<p style="color: grey">
Python
recipe 576719
by <a href="/recipes/users/4169863/">marlonamor</a>
(<a href="/recipes/tags/flat/">flat</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/itertools/">itertools</a>, <a href="/recipes/tags/list/">list</a>, <a href="/recipes/tags/nested/">nested</a>).
Revision 2.
</p>
<p>This flattenizes any nested level list. I couln't find this in itertools module so I wrote it. Python 3 may be required.</p>