diff options
author | Raymond Hettinger <python@rcn.com> | 2008-02-12 01:18:03 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-02-12 01:18:03 (GMT) |
commit | 116f72fa5ceb864efcc47da2f8c437fd29c7e8b3 (patch) | |
tree | af5cb9fde09d843bd60349f4841a3e001c39fa49 /Lib/decimal.py | |
parent | 19a5c29d27a4d65c82658a9b30d00578bef1a913 (diff) | |
download | cpython-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.py | 14 |
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. |