summaryrefslogtreecommitdiffstats
path: root/Lib/decimal.py
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2012-12-15 21:33:33 (GMT)
committerStefan Krah <skrah@bytereef.org>2012-12-15 21:33:33 (GMT)
commit040e3118267bda53b34e35470f7ef0f6dc40cfad (patch)
treeca2534dbb95f20231207ebbd596f7fb0f8b222e0 /Lib/decimal.py
parent618c2e13ca410f342bb057e62e24478b585744aa (diff)
downloadcpython-040e3118267bda53b34e35470f7ef0f6dc40cfad.zip
cpython-040e3118267bda53b34e35470f7ef0f6dc40cfad.tar.gz
cpython-040e3118267bda53b34e35470f7ef0f6dc40cfad.tar.bz2
Issue #15783: Except for the number methods, the C version of decimal now
supports all None default values present in decimal.py. These values were largely undocumented.
Diffstat (limited to 'Lib/decimal.py')
-rw-r--r--Lib/decimal.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py
index b74ab01..746b34a 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -2596,7 +2596,7 @@ class Decimal(object):
ans = ans._fix(context)
return ans
- def same_quantum(self, other):
+ def same_quantum(self, other, context=None):
"""Return True if self and other have the same exponent; otherwise
return False.
@@ -2914,7 +2914,7 @@ class Decimal(object):
except TypeError:
return 0
- def canonical(self, context=None):
+ def canonical(self):
"""Returns the same Decimal object.
As we do not have different encodings for the same number, the
@@ -2934,7 +2934,7 @@ class Decimal(object):
return ans
return self.compare(other, context=context)
- def compare_total(self, other):
+ def compare_total(self, other, context=None):
"""Compares self to other using the abstract representations.
This is not like the standard compare, which use their numerical
@@ -3007,7 +3007,7 @@ class Decimal(object):
return _Zero
- def compare_total_mag(self, other):
+ def compare_total_mag(self, other, context=None):
"""Compares self to other using abstract repr., ignoring sign.
Like compare_total, but with operand's sign ignored and assumed to be 0.
@@ -3029,7 +3029,7 @@ class Decimal(object):
else:
return _dec_from_triple(1, self._int, self._exp, self._is_special)
- def copy_sign(self, other):
+ def copy_sign(self, other, context=None):
"""Returns self with the sign of other."""
other = _convert_other(other, raiseit=True)
return _dec_from_triple(other._sign, self._int,
@@ -4182,7 +4182,7 @@ class Context(object):
"""
if not isinstance(a, Decimal):
raise TypeError("canonical requires a Decimal as an argument.")
- return a.canonical(context=self)
+ return a.canonical()
def compare(self, a, b):
"""Compares values numerically.