def repeat(item, count=None): if count is None: while True: yield item else: for i in compatible.irange(count): yield item
def range(*args): s = slice(*args) return iter(compatible.irange(s.start or 0, s.stop or sys.maxsize, s.step or 1))