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)
When I involve
for i in xrange(len(Funcs2)):
Funcs.append(lambda i=i,*args, **kwargs: (Funcs2[i](*args,
**kwargs)[IndDict[left_arr_indexes[i]]]))
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.
--
http://mail.python.org/mailman/listinfo/python-list