summaryrefslogtreecommitdiffstats
path: root/Lib/decimal.py
diff options
context:
space:
mode:
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 873f7c0..2745065 100644
--- a/Lib/decimal.py
+++ b/Lib/decimal.py
@@ -1518,6 +1518,20 @@ class Decimal(_numbers.Real, _numbers.Inexact):
__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 _fix_nan(self, context):
"""Decapitate the payload of a NaN to fit the context"""
payload = self._int