Popular recipes by Ulrik Sverdrup http://code.activestate.com/recipes/users/4172166/2009-11-06T11:38:43-08:00ActiveState Code RecipesCaching iterable wrapper (Python)
2009-11-06T11:38:43-08:00Ulrik Sverdruphttp://code.activestate.com/recipes/users/4172166/http://code.activestate.com/recipes/576941-caching-iterable-wrapper/
<p style="color: grey">
Python
recipe 576941
by <a href="/recipes/users/4172166/">Ulrik Sverdrup</a>
(<a href="/recipes/tags/cached/">cached</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/iterator/">iterator</a>).
Revision 8.
</p>
<p>This is a very simple wrapper of an iterator or iterable, such that the iterator can be iterated streamingly without generating all elements or any at all, but the object can still be iterated from the beginning as many times as wanted. In effect, it is a streamingly loaded list.</p>