Popular recipes by Don Sawatzky http://code.activestate.com/recipes/users/4168423/2008-12-14T10:04:29-08:00ActiveState Code RecipesLazy, recursive generator function (Python) 2008-12-14T10:04:29-08:00Don Sawatzkyhttp://code.activestate.com/recipes/users/4168423/http://code.activestate.com/recipes/576585-lazy-recursive-generator-function/ <p style="color: grey"> Python recipe 576585 by <a href="/recipes/users/4168423/">Don Sawatzky</a> (<a href="/recipes/tags/algorithm/">algorithm</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/lazy_evaluation/">lazy_evaluation</a>, <a href="/recipes/tags/recursion/">recursion</a>). Revision 4. </p> <p>This procedure was proposed as a challenge to Python and other languages as the most concise coding. See Icon programming on the web. This is a lazy, recursive generator. It can be implemented several ways in Python with lists, iteration, and recursion. However, the lists increase in size exponentially with each iteration and recursion plus they are saved in every recursion. This recipe develops a lazy generator function.</p>