Mercurial > cpython-lru_cache-weakref
diff Lib/decimal.py @ 51297:5b713045ea90
Register decimals as numbers.Number
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Tue, 03 Feb 2009 03:54:28 +0000 |
| parents | fd8af46d3615 |
| children | 51db18084ecb |
line wrap: on
line diff
--- a/Lib/decimal.py Tue Feb 03 02:30:19 2009 +0000 +++ b/Lib/decimal.py Tue Feb 03 03:54:28 2009 +0000 @@ -136,6 +136,7 @@ import copy as _copy import math as _math +import numbers as _numbers try: from collections import namedtuple as _namedtuple @@ -3695,6 +3696,12 @@ 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 #######################################################
