Hi all, This is a little function to compare two iterators:
def icmp(a, b): for xa in a: try: xb = b.next() d = cmp(xa, xb) if (d != 0): return d except StopIteration: return 1 try: b.next() return -1 except StopIteration: return 0 It's modelled after the way cmp treats lists - if a and b are lists, icmp(iter(a), iter(b)) should always be the same as cmp(a, b). Is this any good? Would it be any use? Should this be added to itertools? tom -- I content myself with the Speculative part [...], I care not for the Practick. I seldom bring any thing to use, 'tis not my way. Knowledge is my ultimate end. -- Sir Nicholas Gimcrack -- http://mail.python.org/mailman/listinfo/python-list