This method implements the usual Python comparison function. It can be used to test two colors for equality. The definition of inequality is pretty arbitary, so we will just use their #RRGGBB color names to do the comparison.
# - - - C o l o r . _ _ c m p _ _ def __cmp__ ( self, other ): """Compare two colors.""" return cmp ( str(self), str(other) )