Current DecimalTuple definition is:
classDecimalTuple(NamedTuple):
sign: intdigits: tuple[int, ...]
exponent: int
source: https://github.com/python/typeshed/blob/main/stdlib/_decimal.pyi#L16
But if a decimal value is NaN the exponent is of type str. The following example illustrate that:
>>>fromdecimalimportDecimal>>>exponent=Decimal('NaN').as_tuple().exponent>>>print(exponent)
n>>>print(type(exponent))
<class'str'>>>>It seems like the correct definition should be like this:
classDecimalTuple(NamedTuple):
sign: intdigits: tuple[int, ...]
exponent: Union[int, str]
Current
DecimalTupledefinition is:source: https://github.com/python/typeshed/blob/main/stdlib/_decimal.pyi#L16
But if a decimal value is
NaNthe exponent is of typestr. The following example illustrate that:It seems like the correct definition should be like this: