Ticket #14065: trac_14065-combinatorial_object_cmp-review-mh.patch

File trac_14065-combinatorial_object_cmp-review-mh.patch, 1.2 KB (added by mhansen, 8 years ago)
  • sage/combinat/combinat.py

    # HG changeset patch
    # User Mike Hansen <mhansen@gmail.com>
    # Date 1360791279 0
    # Node ID 2ba7f37378f8dabe14e4abe708e6d951b3426a0e
    # Parent  826f08fac8e9d8f1859bd324816d6066e9b48f47
    Simplify code for #14065
    
    diff --git a/sage/combinat/combinat.py b/sage/combinat/combinat.py
    a b  
    753753                NotImplementedError: BUG: sort algorithm for elements of 'None' not implemented
    754754        """
    755755        if isinstance(other, CombinatorialObject):
    756             if self._list == other._list:
    757                 return 0
    758             if self._list < other._list:
    759                 return -1
    760             return 1
    761         if self._list == other:
    762             return 0
    763         if self._list < other:
    764             return -1
    765         return 1
     756            return cmp(self._list, other._list)
     757        else:
     758            return cmp(self._list, other)
    766759
    767760    def _repr_(self):
    768761        """
     
    959952                ...
    960953                AttributeError: 'NoneType' object has no attribute 'zero_element'
    961954        """
    962         return self._list.__len__() > 0
     955        return bool(self._list)
    963956
    964957    def __len__(self):
    965958        """