Ticket #12999: trac_12999-invalidate-order-comparisons-Color.patch

File trac_12999-invalidate-order-comparisons-Color.patch, 3.0 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 1337904841 25200
    # Node ID 8eabc2db2cca52b7b89eedbe74392d4f8e22e84c
    # Parent  86d94fce2a0b79c6d9788d1e37be96e8f49f39c3
    Invalidate order comparisons of Color objects
    
    diff --git a/sage/plot/colors.py b/sage/plot/colors.py
    a b  
    430430        """
    431431        return "RGB color %s" % (self.__rgb, )
    432432
     433    def __lt__(self, right):
     434        """
     435        Check whether a :class:`Color` object is less than some other
     436        object. This doesn't make sense, and so we conclude that it is
     437        not less than the other object.
     438
     439        INPUT:
     440
     441        - ``right`` - an object
     442
     443        OUTPUT:
     444
     445        - boolean - False
     446
     447        EXAMPLES::
     448
     449            sage: Color('red') < Color('red')
     450            False
     451            sage: Color('blue') < Color('red')
     452            False
     453            sage: Color('red') < "xyzzy"
     454            False
     455        """
     456        return False
     457
     458    def __le__(self, right):
     459        """
     460        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.
     463
     464        INPUT:
     465
     466        - ``right`` - an object
     467
     468        OUTPUT:
     469
     470        - boolean - False
     471
     472        EXAMPLES::
     473
     474            sage: Color('red') <= Color('red')
     475            False
     476            sage: Color('blue') <= Color('red')
     477            False
     478            sage: Color('red') <= "xyzzy"
     479            False
     480        """
     481        return False
     482
    433483    def __eq__(self, right):
    434484        """
    435485        Compare two :class:`Color` objects to determine whether
     
    486536        """
    487537        return not (self == right)
    488538
     539    def __gt__(self, right):
     540        """
     541        Check whether a :class:`Color` object is greater than some other
     542        object. This doesn't make sense, and so we conclude that it is
     543        not greater than the other object.
     544
     545        INPUT:
     546
     547        - ``right`` - an object
     548
     549        OUTPUT:
     550
     551        - boolean - False
     552
     553        EXAMPLES::
     554
     555            sage: Color('red') > Color('red')
     556            False
     557            sage: Color('blue') > Color('red')
     558            False
     559            sage: Color('red') > "xyzzy"
     560            False
     561        """
     562        return False
     563
     564    def __ge__(self, right):
     565        """
     566        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.
     570
     571        INPUT:
     572
     573        - ``right`` - an object
     574
     575        OUTPUT:
     576
     577        - boolean - False
     578
     579        EXAMPLES::
     580
     581            sage: Color('red') >= Color('red')
     582            False
     583            sage: Color('blue') >= Color('red')
     584            False
     585            sage: Color('red') >= "xyzzy"
     586            False
     587        """
     588        return False
     589
    489590    def __hash__(self):
    490591        """
    491592        Return the hash value of a color.