(self, other)
return (i1 > i2) - (i1 < i2)
Comparison of two GeometryEntities.
Comparison of two GeometryEntities.
Comparison of two GeometryEntities .
def __cmp__(self, other):
        """Comparison of two GeometryEntities."""
        n1 = self.__class__.__name__
        n2 = other.__class__.__name__
        c = (n1 > n2) - (n1 < n2)
        if not c:
            return 0

        i1 = -1
        for cls in self.__class__.__mro__:
            try:
                i1 = ordering_of_classes.index(cls.__name__)
                break
            except ValueError:
                i1 = -1
        if i1 == -1:
            return c

        i2 = -1
        for cls in other.__class__.__mro__:
            try:
                i2 = ordering_of_classes.index(cls.__name__)
                break
            except ValueError:
                i2 = -1
        if i2 == -1:
            return c

        return (i1 > i2) - (i1 < i2)
def __cmp__ ( self , other ) : n1 = self . __class__ . __name__ n2 = other . __class__ . __name__ c = ( n1 > n2 ) - ( n1 < n2 ) if not c : return 0 i1 = - 1 for cls in self . __class__ . __mro__ : try : i1 = ordering_of_classes . index ( cls . __name__ ) break except ValueError : i1 = - 1 if i1 == - 1 : return c i2 = - 1 for cls in other . __class__ . __mro__ : try : i2 = ordering_of_classes . index ( cls . __name__ ) break except ValueError : i2 = - 1 if i2 == - 1 : return c return ( i1 > i2 ) - ( i1 < i2 )