l.s.u.CachingIterator : class documentation

Part of lp.services.utils View In Hierarchy

Remember the items extracted from the iterator for the next iteration.

Some generators and iterators are expensive to calculate, like calculating the merge sorted revision graph for a bazaar branch, so you don't want to call them too often. Rearranging the code so it doesn't call the expensive iterator can make the code awkward. This class provides a way to have the iterator called once, and the results stored. The results can then be iterated over again, and more values retrieved from the iterator if necessary.

Method __init__ Undocumented
Method __iter__ Undocumented
def __init__(self, iterator_factory):
Undocumented
def __iter__(self):
Undocumented
API Documentation for Launchpad, generated by pydoctor at 2022-06-16 00:00:12.