def __cache(self, n):
        """Cache the next n elements or raises StopIteration."""
        i = 0
        while i < n:
            self.__next()
            i += 1
Cache the next n elements or raises StopIteration.
recipes/Python/534114_List_wrapper_generators_indexable/recipe-534114.py