Python with generators
The yield from transparently handles sending the values or throwing values into the sub-generator. Normally you would just call comb but since it returns a gene
The yield from transparently handles sending the values or throwing values into the sub-generator. Normally you would just call comb but since it returns a generator you need to use yield from syntax.\n\n```\nclass CombinationIterator:\n    def __init__(self, characters: str, k: int):\n        def comb(current, idx):\n            if len(current) == k:\n                yield "".join(current)\n                return\n            for i in range(idx, len(characters)):\n                current.append(characters[i])\n                yield from comb(current, i + 1)\n                current.pop()\n\n        self.gen = comb([], 0)\n        self.predef = next(self.gen, "-1")\n\n    def next(self) -> str:\n        toreturn, self.predef = self.predef, next(self.gen, "-1")\n        return toreturn\n\n    def hasNext(self) -> bool:\n        return self.predef != "-1"\n\t\t
[]