mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Register decimals as numbers.Number
This commit is contained in:
parent
4a1b62a555
commit
2c8585b0af
2 changed files with 14 additions and 0 deletions
|
@ -136,6 +136,7 @@ __all__ = [
|
|||
|
||||
import copy as _copy
|
||||
import math as _math
|
||||
import numbers as _numbers
|
||||
|
||||
try:
|
||||
from collections import namedtuple as _namedtuple
|
||||
|
@ -3608,6 +3609,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 #######################################################
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue