We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current DecimalTuple definition is:
DecimalTuple
class DecimalTuple(NamedTuple): sign: int digits: 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:
NaN
str
>>> from decimal import Decimal >>> exponent = Decimal('NaN').as_tuple().exponent >>> print(exponent) n >>> print(type(exponent)) <class 'str'> >>>
It seems like the correct definition should be like this:
class DecimalTuple(NamedTuple): sign: int digits: tuple[int, ...] exponent: Union[int, str]
The text was updated successfully, but these errors were encountered:
Looks like it can also be N for a signaling NaN and F for infinity. I suppose we could do int | Literal["n", "N", "F"].
N
F
int | Literal["n", "N", "F"]
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Current
DecimalTuple
definition is:source: https://github.com/python/typeshed/blob/main/stdlib/_decimal.pyi#L16
But if a decimal value is
NaN
the exponent is of typestr
. The following example illustrate that:It seems like the correct definition should be like this:
The text was updated successfully, but these errors were encountered: