Most viewed recipes tagged "decorators" and "generators"http://code.activestate.com/recipes/tags/decorators+generators/views/2012-01-03T06:10:18-08:00ActiveState Code RecipesIndexable Generator (Python)
2012-01-03T06:10:18-08:00Peter Donishttp://code.activestate.com/recipes/users/4180313/http://code.activestate.com/recipes/578000-indexable-generator/
<p style="color: grey">
Python
recipe 578000
by <a href="/recipes/users/4180313/">Peter Donis</a>
(<a href="/recipes/tags/decorators/">decorators</a>, <a href="/recipes/tags/generators/">generators</a>).
Revision 4.
</p>
<p>A decorator for generators that makes them indexable like a
sequence.</p>
Memoize Generator (Python)
2012-01-02T05:53:19-08:00Peter Donishttp://code.activestate.com/recipes/users/4180313/http://code.activestate.com/recipes/577992-memoize-generator/
<p style="color: grey">
Python
recipe 577992
by <a href="/recipes/users/4180313/">Peter Donis</a>
(<a href="/recipes/tags/decorators/">decorators</a>, <a href="/recipes/tags/generators/">generators</a>, <a href="/recipes/tags/memoization/">memoization</a>, <a href="/recipes/tags/memoize/">memoize</a>).
Revision 2.
</p>
<p>A wrapper class for generators that "memoizes" them, so that even
if the generator is realized multiple times, each term only gets
computed once (after that the result is simply returned from a
cache).</p>