UniCoreFW

is_number()

Check if obj is a number (int or float).

Implementation

Args: obj: The object to check Returns: True if obj is a number, False otherwise

Example

is_number(1)

Expected output: True

Source Code

def is_number(obj: Any) -> bool: return isinstance(obj, (int, float))