Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Current DecimalTuple definition is:
classDecimalTuple(NamedTuple): sign: intdigits: tuple[int, ...] exponent: intsource: 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]Metadata
Metadata
Assignees
Labels
No labels