Popular recipes by John Crichton http://code.activestate.com/recipes/users/4181975/2012-12-11T16:59:14-08:00ActiveState Code RecipesAn analogue of enumerate for nested lists. (Python)
2012-12-11T16:59:14-08:00John Crichtonhttp://code.activestate.com/recipes/users/4181975/http://code.activestate.com/recipes/578376-an-analogue-of-enumerate-for-nested-lists/
<p style="color: grey">
Python
recipe 578376
by <a href="/recipes/users/4181975/">John Crichton</a>
(<a href="/recipes/tags/enumerate/">enumerate</a>, <a href="/recipes/tags/index/">index</a>, <a href="/recipes/tags/iterator/">iterator</a>, <a href="/recipes/tags/list/">list</a>).
Revision 6.
</p>
<p>A generator function which enables traversal and modification of deeply nested lists. Together with the supplied helper functions it could be useful when working with data stored in deeply
nested lists, particularly when the level of nesting precludes a recursive approach.</p>
Recursively defined, Haskell-style infinite lists (Python)
2012-05-04T14:09:14-07:00John Crichtonhttp://code.activestate.com/recipes/users/4181975/http://code.activestate.com/recipes/578119-recursively-defined-haskell-style-infinite-lists/
<p style="color: grey">
Python
recipe 578119
by <a href="/recipes/users/4181975/">John Crichton</a>
(<a href="/recipes/tags/decorator/">decorator</a>, <a href="/recipes/tags/functional/">functional</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/infinite/">infinite</a>, <a href="/recipes/tags/itertools/">itertools</a>, <a href="/recipes/tags/lazy/">lazy</a>, <a href="/recipes/tags/recursive/">recursive</a>).
Revision 2.
</p>
<p>A decorator to simplify the creation of recursively defined, Haskell-style infinite lists -- ie. recursive generators -- inspired by Raymond Hettinger's "Technique for cyclical iteration" [*]. </p>
<p>[*] <a href="http://code.activestate.com/recipes/576961-technique-for-cyclical-iteration/" rel="nofollow">http://code.activestate.com/recipes/576961-technique-for-cyclical-iteration/</a> </p>