def iter(self, start=0, end=None):
        """Iterate through successive history items.

        Parameters
        ----------
        end : int
            Index of the last item to loop through + 1.

        start : int
            Initial index for the loop (0 by default).

        """
        if end is None:
            end = self._index + 1
        elif end == 0:
            raise StopIteration()
        if start >= end:
            raise StopIteration()
        # Check arguments.
        assert 0 <= end <= len(self._history)
        assert 0 <= start <= end - 1
        for i in range(start, end):
            yield self._history[i]
Iterate through successive history items.

        Parameters
        ----------
        end : int
            Index of the last item to loop through + 1.

        start : int
            Initial index for the loop (0 by default).