def circular(seq): while 1: try: for x in seq: yield x except StopIteration: pass