Remove uninformative itertools recipe by rhettinger · Pull Request #100253 · python/cpython
def pad_none(iterable): "Returns the sequence elements and then returns None indefinitely." return chain(iterable, repeat(None))
def ncycles(iterable, n): "Returns the sequence elements n times" return chain.from_iterable(repeat(tuple(iterable), n))
>>> list(islice(pad_none('abc'), 0, 6)) ['a', 'b', 'c', None, None, None]
>>> list(ncycles('abc', 3)) ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']