Thanks all, especially Dennis for your detailed answer.
left_arr_indexes is list of nonnegative integers, eg [0,0,0,1,1,4]
IndDict is a dict like {0: [1,2], 3: [0,1], 10:[0,2,3]}, so that's why
I don't use python list instead.
The code is taken from OpenOpt framework that I develop. Currently I
hav
Carl Banks writes:
> def create_funcs_caller(i):
> def func(*args,**kwargs):
> return(Funcs2[i](*args,**kwargs)[IndDict[left_arr_indexes[i]]])
> retirm func
>
> for i in xrange(len(Funcs2)):
> Funcs.append(create_funcs_caller(i))
I prefer to get rid of the index variable:
On Aug 15, 12:17 am, dmitrey wrote:
> Hi all,
> could you inform me how to do it properly?
>
> I have the cycle
>
> for i in xrange(len(Funcs2)): # Funcs2 is Python dict
> Funcs.append(lambda *args, **kwargs: (Funcs2[i](*args, **kwargs)
> [IndDict[left_arr_indexes[i]]]))
>
> So, all the Funcs
Hi all,
could you inform me how to do it properly?
I have the cycle
for i in xrange(len(Funcs2)): # Funcs2 is Python dict
Funcs.append(lambda *args, **kwargs: (Funcs2[i](*args, **kwargs)
[IndDict[left_arr_indexes[i]]]))
So, all the Funcs are initialized with i = last index = len(Funcs2)
Wh