(typechar, value)
Check if variable can be converted to the given type and convert if necessary.
Check if variable can be converted to the given type and convert if necessary.
Check if variable can be converted to the given type and convert if necessary .
def to_type(typechar, value):
    """Check if variable can be converted to the given type and convert if necessary."""
    if typechar == STR:
        return pass_string(value)
    elif typechar == INT:
        return to_integer(value)
    elif typechar == SNG:
        return to_single(value)
    elif typechar == DBL:
        return to_double(value)
    raise ValueError('%s is not a valid sigil.' % typechar)
def to_type ( typechar , value ) : if typechar == STR : return pass_string ( value ) elif typechar == INT : return to_integer ( value ) elif typechar == SNG : return to_single ( value ) elif typechar == DBL : return to_double ( value ) raise ValueError ( '%s is not a valid sigil.' % typechar )