def _func_set_key(dict, key, val): dict[key] = val def set_dir_flag(key): """set_dir_flag(key): Return a new function which can set a simple key in a dictionary. This basically takes the place of a function taking a mod_snake.FLAG type layout.""" return lambda d,s,flag,key=key,fn=_func_set_key: fn(d,key,flag)