// Return value >= 0 is the index where the sequences differs. // -1: reached the end of o1 without a difference // -2: reached the end of both seqeunces without a difference // -3: reached the end of o2 without a difference private static int cmp(PyObject o1, int ol1, PyObject o2, int ol2) { if (ol1 < 0) ol1 = o1.__len__(); if (ol2 < 0) ol2 = o2.__len__(); int i = 0; for (; i < ol1 && i < ol2; i++) { if (!o1.__getitem__(i)._eq(o2.__getitem__(i)).__nonzero__()) return i; } if (ol1 == ol2) return -2; return (ol1 < ol2) ? -1 : -3; }