Ciprian Dorin, Craciun napisaĆ(a): > Python way: > def compare (a, b, comp = eq) : > if len (a) != len (b) : > return False > for i in xrange (len (a)) : > if not comp (a[i], b[i]) : > return False > return True This is shorter, but I'm not sure if more pythonic: def compare(a, b, compfunc=eq): return all(compfunc(aelem, belem) for aelem, belem in zip_longest (a, b, fillvalue=object()))
Regards, Marek -- http://mail.python.org/mailman/listinfo/python-list