D
dmitrey
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(*args, **kwargs)
[IndDict[left_arr_indexes]]))
So, all the Funcs are initialized with i = last index = len(Funcs2)
When I involve
for i in xrange(len(Funcs2)):
Funcs.append(lambda i=i,*args, **kwargs: (Funcs2(*args,
**kwargs)[IndDict[left_arr_indexes]]))
I get "list indices must be integers, not dict" (and i is equal to
Python dictionary, that is Funcs2)
So, how to do it correctly?
Thank you in advance, D.
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(*args, **kwargs)
[IndDict[left_arr_indexes]]))
So, all the Funcs are initialized with i = last index = len(Funcs2)
When I involve
for i in xrange(len(Funcs2)):
Funcs.append(lambda i=i,*args, **kwargs: (Funcs2(*args,
**kwargs)[IndDict[left_arr_indexes]]))
I get "list indices must be integers, not dict" (and i is equal to
Python dictionary, that is Funcs2)
So, how to do it correctly?
Thank you in advance, D.