def cast(value):
 try:
  return (float(value) if ('.' in value) else int(value))
 except ValueError:
  return value

def cast ( value ) : try : return ( float ( value ) if ( '.' in value ) else int ( value ) ) except ValueError : return value
symbolically cast x to a scalar of given dtype .