summaryrefslogtreecommitdiffstats
path: root/Lib/decimal.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-02-03 03:42:07 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-02-03 03:42:07 (GMT)
commit45fd4763fffeaeb9d3fbb3dee2f861fad85b8d2b (patch)
tree797b9c52654b978e239a979cc0bbec029c640b01 /Lib/decimal.py
parent154ab71e0bcd403fa3aba589d77800eeebdd2413 (diff)
downloadcpython-45fd4763fffeaeb9d3fbb3dee2f861fad85b8d2b.zip
cpython-45fd4763fffeaeb9d3fbb3dee2f861fad85b8d2b.tar.gz
cpython-45fd4763fffeaeb9d3fbb3dee2f861fad85b8d2b.tar.bz2
Register decimals as numbers.Number
Diffstat (limited to 'Lib/decimal.py')
-rw-r--r--Lib/decimal.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py
index 661d6ed..3ad80b3 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -135,6 +135,7 @@ __all__ = [
]
import copy as _copy
+import numbers as _numbers
try:
from collections import namedtuple as _namedtuple
@@ -3567,6 +3568,12 @@ def _dec_from_triple(sign, coefficient, exponent, special=False):
return self
+# Register Decimal as a kind of Number (an abstract base class).
+# However, do not register it as Real (because Decimals are not
+# interoperable with floats).
+_numbers.Number.register(Decimal)
+
+
##### Context class #######################################################