The python Decimal
object is not currently specified a subclass of the Real
abstract base class:
from numbers import Real
from decimal import Decimal
isinstance(Decimal("1.0"), numbers.Real) # False
This is easily changed by registering Decimal
as a subclass:
Real.register(Decimal)
But it makes me ask the question: why is Decimal
not registered this way to begin with? Is there some practical reason, or design reason, that it would be a bad idea to make this assumption about decimal instances?