# AUTOGENERATED! DO NOT EDIT! File to edit: ../../nbs/40_helper.numbers.ipynb.

# %% auto 0
__all__ = ['is_number']

# %% ../../nbs/40_helper.numbers.ipynb 2
from typing import Union

# %% ../../nbs/40_helper.numbers.ipynb 4
def is_number(
        x: Union[float, int, complex, str]
        ) -> bool:
    """Return `True` if the input `x` represents a number.
    
    This function is different from Python's built-in `is_numeric`
    function, which returns `True` when all characters of a string
    are digits.
    """
    if isinstance(x, (float, int, complex)):
        return True
    #For the case where string is None
    if x is None:
        return False
    if x and x[0] == '-': x = x[1:]
    return x.replace(".", "1", 1).isdigit()
