Peter Otten <__pete...@web.de> writes: > Arnaud Delobelle wrote: > >> def equal_items(iter1, iter2, key=lambda x: x): >> iter1, iter2 = iter(iter1), iter(iter2) >> for x, y in izip(iter1, iter2): >> if key(x) != key(y): >> return False >> for x, y in izip_longest(iter1, iter2): >> return False >> return True >> >> (untested) > > This will fail when iter1 yields one more item than iter2. izip() then > consumes one extra item:
Ah yes! And this is why I should have tested it. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list