def _clear_recursion_errors(self): def filter(key, value): return isinstance(value, FailedLeftRecursion) prune_dict(self._memos, filter)
def prune(cache, cutpos): prune_dict(cache, lambda k, _: k[0] < cutpos)