def __cmp(self, other, comparitor):
        """Shared helper for rich comparison operators.

        This allows the comparison operators to be relatively simple and share
        the complex logic.

        If the username is not considered case sensitive then lower the
        username of both self and the other, and handle that the other can be
        either another :class:`~alot.account.Address`, or a `str` instance.

        :param other: The other address to compare against
        :type other: str or ~alot.account.Address
        :param callable comparitor: A function with the a signature
            (str, str) -> bool that will compare the two instance.
            The intention is to use functions from the operator module.
        """
        if isinstance(other, str):
            try:
                ouser, odomain = other.split('@')
            except ValueError:
                ouser, odomain = '', ''
        else:
            ouser = other.username
            odomain = other.domainname

        if not self.case_sensitive:
            ouser = ouser.lower()
            username = self.username.lower()
        else:
            username = self.username

        return (comparitor(username, ouser) and
                comparitor(self.domainname.lower(), odomain.lower()))
def __cmp ( self , other , comparitor ) : if isinstance ( other , str ) : try : ouser , odomain = other . split ( '@' ) except ValueError : ouser , odomain = '' , '' else : ouser = other . username odomain = other . domainname if not self . case_sensitive : ouser = ouser . lower ( ) username = self . username . lower ( ) else : username = self . username return ( comparitor ( username , ouser ) and comparitor ( self . domainname . lower ( ) , odomain . lower ( ) ) )
Shared helper for rich comparison operators.

        This allows the comparison operators to be relatively simple and share
        the complex logic.

        If the username is not considered case sensitive then lower the
        username of both self and the other, and handle that the other can be
        either another :class:`~alot.account.Address`, or a `str` instance.

        :param other: The other address to compare against
        :type other: str or ~alot.account.Address
        :param callable comparitor: A function with the a signature
            (str, str) -> bool that will compare the two instance.
            The intention is to use functions from the operator module.