"Christopher Spears" <[EMAIL PROTECTED]> wrote

def __cmp__(self, other):
       if self.x == other.x and self.y == other.y:
    return 0
elif self.x < other.x and self.y < other.y:
    return -1
elif self.x > other.x and self.y > other.y:
    return 1

Rather than comparing in that manner I'd take a different approach.
I'd measure the length from the origin thus any point that was inside
the circle upon whose ciorcumference the point sits is less than
the point. Any point on the circumference is equal and any point
outside the circle is greater...

[ Another approach with similar results is to convert the coordinates
into complex numbers and then use the complex number cmp method
to compare those. ]

Alan G.


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to