summaryrefslogtreecommitdiffstats
path: root/Lib/decimal.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-07-05 05:36:39 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-07-05 05:36:39 (GMT)
commite0f1581babe682552d7eadc4e54636b1c2775f0b (patch)
treed822f456653324d38b4403c0c1fa2c1602c2bce5 /Lib/decimal.py
parent71432f1db62731faf5cda20b6d597e40e7b6239d (diff)
downloadcpython-e0f1581babe682552d7eadc4e54636b1c2775f0b.zip
cpython-e0f1581babe682552d7eadc4e54636b1c2775f0b.tar.gz
cpython-e0f1581babe682552d7eadc4e54636b1c2775f0b.tar.bz2
* Fixup docstrings
* Make capitals default part of DefaultContext
Diffstat (limited to 'Lib/decimal.py')
-rw-r--r--Lib/decimal.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py
index 61f8c33..d5f6795 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -134,7 +134,6 @@ __all__ = [
import threading
import copy
-import math
import operator
#Exponent Range
@@ -2120,8 +2119,7 @@ class Context(object):
Emax - Maximum exponent
capitals - If 1, 1*10^1 is printed as 1E+1.
If 0, printed as 1e1
- (Defaults to 1)
- clamp - If 1, change exponents if too high (Default 0)
+ _clamp - If 1, change exponents if too high (Default 0)
"""
DefaultLock = threading.Lock()
@@ -2130,7 +2128,7 @@ class Context(object):
trap_enablers=None, flags=None,
_rounding_decision=None,
Emin=None, Emax=None,
- capitals=1, _clamp=0,
+ capitals=None, _clamp=0,
_ignored_flags=[]):
if flags is None:
flags = dict.fromkeys(Signals, 0)
@@ -2208,7 +2206,7 @@ class Context(object):
return int(self.Emin - self.prec + 1)
def Etop(self):
- """Returns maximum exponent (= Emin - prec + 1)"""
+ """Returns maximum exponent (= Emax - prec + 1)"""
return int(self.Emax - self.prec + 1)
def _set_rounding_decision(self, type):
@@ -2430,7 +2428,7 @@ class Context(object):
return a.__mul__(b, context=self)
def normalize(self, a):
- """normalize reduces its operand to its simplest form.
+ """normalize reduces an operand to its simplest form.
Essentially a plus operation with all trailing zeros removed from the
result.
@@ -2968,7 +2966,8 @@ DefaultContext = Context(
flags=None,
_rounding_decision=ALWAYS_ROUND,
Emax=DEFAULT_MAX_EXPONENT,
- Emin=DEFAULT_MIN_EXPONENT
+ Emin=DEFAULT_MIN_EXPONENT,
+ capitals=1
)
# Pre-made alternate contexts offered by the specification