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