def assign_variable_types(variables,local_dict={}, global_dict={},
                          auto_downcast=1,
                          type_converters=converters.default):
    incoming_vars = {}
    incoming_vars.update(global_dict)
    incoming_vars.update(local_dict)
    variable_specs = []
    errors = {}
    for var in variables:
        try:
            example_type = incoming_vars[var]

            # look through possible type specs to find which one
            # should be used to for example_type
            spec = None
            for factory in type_converters:
                if factory.type_match(example_type):
                    spec = factory.type_spec(var,example_type)
                    break
            if not spec:
                # should really define our own type.
                raise IndexError
            else:
                variable_specs.append(spec)
        except __HOLE__:
            errors[var] = ("The type and dimensionality specifications" +
                           "for variable '" + var + "' are missing.")
        except IndexError:
            errors[var] = ("Unable to convert variable '" + var +
                           "' to a C++ type.")
    if errors:
        raise TypeError(format_error_msg(errors))

    if auto_downcast:
        variable_specs = downcast(variable_specs)
    return variable_specs
dataset/ETHPy150Open scipy/scipy/scipy/weave/ext_tools.py/assign_variable_types