Ticket #12999: trac_12999-allow-ge-le.patch

File trac_12999-allow-ge-le.patch, 1.9 KB (added by Keshav Kini, 10 years ago)

apply to $SAGE_ROOT/devel/sage

  • sage/plot/colors.py

    # HG changeset patch
    # User Keshav Kini <keshav.kini@gmail.com>
    # Date 1337907415 25200
    # Node ID bc6aae82c09a61c7a056fe5c82ae285f8f1e94c7
    # Parent  8eabc2db2cca52b7b89eedbe74392d4f8e22e84c
    Let <= and >= return True when lhs == rhs
    
    diff --git a/sage/plot/colors.py b/sage/plot/colors.py
    a b  
    458458    def __le__(self, right):
    459459        """
    460460        Check whether a :class:`Color` object is less than or equal to
    461         some other object. This doesn't make sense, and so we conclude
    462         that it is not less than or equal to the other object.
     461        some other object. It wouldn't make sense for it to be less than
     462        the other object, so we treat this the same as an equality
     463        check.
    463464
    464465        INPUT:
    465466
     
    472473        EXAMPLES::
    473474
    474475            sage: Color('red') <= Color('red')
    475             False
     476            True
    476477            sage: Color('blue') <= Color('red')
    477478            False
    478479            sage: Color('red') <= "xyzzy"
    479480            False
    480481        """
    481         return False
     482        return self == right
    482483
    483484    def __eq__(self, right):
    484485        """
     
    564565    def __ge__(self, right):
    565566        """
    566567        Check whether a :class:`Color` object is greater than or equal
    567         to some other object. This doesn't make sense, and so we
    568         conclude that it is not greater than or equal to the other
    569         object.
     568        to some other object. It wouldn't make sense for it to be
     569        greater than the other object, so we treat this the same as an
     570        equality check.
    570571
    571572        INPUT:
    572573
     
    579580        EXAMPLES::
    580581
    581582            sage: Color('red') >= Color('red')
    582             False
     583            True
    583584            sage: Color('blue') >= Color('red')
    584585            False
    585586            sage: Color('red') >= "xyzzy"
    586587            False
    587588        """
    588         return False
     589        return self == right
    589590
    590591    def __hash__(self):
    591592        """