def literal_to_float_list(arg_literal : str):
    """Evaluate a string literal (e.g. '[1,2,3]') and return list of floats."""
    try:
        result = eval(arg_literal)
    except SyntaxError:  # Does not get caught by argparse ...
        raise ValueError()
    
    if not isinstance(result, list):
        print("Invalid type for evaluated literal: {}. "
              "Expected type: {}.".format(type(result), list))
        raise TypeError()  # Gets caught by argparse so message is not shown
    
    return [float(i) for i in result]