Compare self to other. Return a decimal value: a or b is a NaN ==> Decimal('NaN') a < b ==> Decimal('-1') a == b ==> Decimal('0') a > b ==> Decimal('1')
(self, other, context=None)
| 877 | return self._cmp(other) >= 0 |
| 878 | |
| 879 | def compare(self, other, context=None): |
| 880 | """Compare self to other. Return a decimal value: |
| 881 | |
| 882 | a or b is a NaN ==> Decimal('NaN') |
| 883 | a < b ==> Decimal('-1') |
| 884 | a == b ==> Decimal('0') |
| 885 | a > b ==> Decimal('1') |
| 886 | """ |
| 887 | other = _convert_other(other, raiseit=True) |
| 888 | |
| 889 | # Compare(NaN, NaN) = NaN |
| 890 | if (self._is_special or other and other._is_special): |
| 891 | ans = self._check_nans(other, context) |
| 892 | if ans: |
| 893 | return ans |
| 894 | |
| 895 | return Decimal(self._cmp(other)) |
| 896 | |
| 897 | def __hash__(self): |
| 898 | """x.__hash__() <==> hash(x)""" |