Message416011
The math.isfinite() docs could be changed to something like, "coerces x to a float if possible and then returns True if x is neither an infinity nor a NaN, and False otherwise." Or there could be a general note about which functions (most of them) coerce to float (which can fail).
With respect to typing and PEP-484, I don't see a bug or documentation issue. Types relationships are useful for verifying which methods are available, but they don't make promises about the range of valid values. For example math.sqrt(float) -> float promises which types are acceptable but doesn't promise that negative inputs won't raise an exception. Likewise, "n: int=10; len(range(n))" is type correct but will raise an OverflowError for "n = 10**100". |
|
Date |
User |
Action |
Args |
2022-03-25 17:52:35 | rhettinger | set | recipients:
+ rhettinger, docs@python, Nathaniel Manista, tfish2 |
2022-03-25 17:52:35 | rhettinger | set | messageid: <1648230755.09.0.546195749712.issue47121@roundup.psfhosted.org> |
2022-03-25 17:52:35 | rhettinger | link | issue47121 messages |
2022-03-25 17:52:34 | rhettinger | create | |
|