is_finite()
Check if obj is a finite number.
Implementation
Args: obj: The object to check Returns: True if obj is a finite number, False otherwise
Example
is_finite(1)
Expected output: True
Source Code
def is_finite(obj: Any) -> bool:
return isinstance(obj, (int, float)) and math.isfinite(obj)