summaryrefslogtreecommitdiffstats
path: root/Lib/decimal.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-02-12 01:18:03 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-02-12 01:18:03 (GMT)
commit116f72fa5ceb864efcc47da2f8c437fd29c7e8b3 (patch)
treeaf5cb9fde09d843bd60349f4841a3e001c39fa49 /Lib/decimal.py
parent19a5c29d27a4d65c82658a9b30d00578bef1a913 (diff)
downloadcpython-116f72fa5ceb864efcc47da2f8c437fd29c7e8b3.zip
cpython-116f72fa5ceb864efcc47da2f8c437fd29c7e8b3.tar.gz
cpython-116f72fa5ceb864efcc47da2f8c437fd29c7e8b3.tar.bz2
Bring decimal a bit closer to the spec for Reals.
Diffstat (limited to 'Lib/decimal.py')
-rw-r--r--Lib/decimal.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/decimal.py b/Lib/decimal.py
index 4f23d33..dbe0695 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -1519,6 +1519,20 @@ class Decimal(object):
__trunc__ = __int__
+ @property
+ def real(self):
+ return self
+
+ @property
+ def imag(self):
+ return Decimal(0)
+
+ def conjugate(self):
+ return self
+
+ def __complex__(self):
+ return complex(float(self))
+
def __long__(self):
"""Converts to a long.