>     def __cmp__ (self, other):
>       # I wish there was a less verbose way to do this!
>         if self.block < other.block:
>             return -1
>         if self.block > other.block:
>             return 1
>         if self.lot < other.lot:
>             return -1
>         if self.lot > other.lot:
>             return 1
>         return 0

A little less verbose:

def __cmp__ (self, other):
    compared = cmp(self.block, other.block)
    if not compared:
        compared = cmp(self.lot, other.lot)
    return compared


HTH, Marc.
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to