def as_int_or_float(val):
    """Infers Python int vs. float from string representation."""
    if type(val) == str:
        ret_val = float(val) if '.' in val else int(val)
        return ret_val
    return val