def num(value):
    """Parse number as float or int."""
    value_float = float(value)
    try:
        value_int = int(value)
    except ValueError:
        return value_float
    return value_int if value_int == value_float else value_float