Message416010
>>> help(math.isfinite)
isfinite(x, /)
Return True if x is neither an infinity nor a NaN, and False otherwise.
So, one would expect the following expression to return `True` or `False`. We instead observe:
>>> math.isfinite(10**1000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OverflowError: int too large to convert to float
(There likewise is a corresponding issue with other, similar, functions).
This especially hurts since PEP-484 states that having a Sequence[float] `xs` does not allow us to infer that `all(issubclass(type(x), float) for x in xs)` actually holds - since a PEP-484 "float" actually does also include "int" (and still, issubclass(int, float) == False).
Now, strictly speaking, `help(math)` states that
DESCRIPTION
This module provides access to the mathematical functions
defined by the C standard.
...but according to "man 3 isfinite", the math.h "isfinite" is a macro and not a function - and the man page does not show type information for that reason. |
|
| Date |
User |
Action |
Args |
| 2022-03-25 17:28:43 | tfish2 | set | recipients:
+ tfish2 |
| 2022-03-25 17:28:43 | tfish2 | set | messageid: <1648229323.49.0.0271955914629.issue47121@roundup.psfhosted.org> |
| 2022-03-25 17:28:43 | tfish2 | link | issue47121 messages |
| 2022-03-25 17:28:43 | tfish2 | create | |
|