def next(self):
        """Next element - can consume the generator."""
        if self.__idx < self.__len:
            key = super(dbcache, self).__getitem__(self.__idx)
            self.__idx += 1
            return self.cache.get(key)
        else:
            return self.__next()
Next element - can consume the generator.
recipes/Python/534114_List_wrapper_generators_indexable/recipe-534114.py