On Mon, 12 Oct 2009 15:45:30 -0500, Peng Yu wrote: > def __cmp__(self, other): > if self._a < other._a: > return -1 > elif self._a > other._a: > return 1 > elif self._b < other._b: > return -1 > elif self._b > other._b: > return 1 > else: > return 0
This can be simplified to: return cmp((self._a, self._b), (other._a, other._b)) -- Steven -- http://mail.python.org/mailman/listinfo/python-list