You have a much simpler solution ! As this is a most common task to iterate on a sequence while keeping track of the index, there is an object just for that :
for i,x in enumerate(iterable): # Here "i" is the index and "x" the element Also, to get some "advance" iteration schemes, have a lot at the module "itertools" ... there is a bunch of very usefull items in it (the most usefull to me bzing "izip") ! Pierre Pujo Aji a écrit : > assume: > you have two list with the same size > L1 = [1,2,3] > L2 = [11,22,33] > you can zip the L1 and L2 into L > L = zip(L1,L2) # L = [(1,11),(2,22),(3,33)] > then you can process: > for x in L: > dosomething(x[0])... > dosomething(x[1])... > I'm not so sure about your problem but > If you want to do something parallel processing then you should go to > threading or pyro. > Cheers, > pujo > > -- Pierre Barbier de Reuille INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP Botanique et Bio-informatique de l'Architecture des Plantes TA40/PSII, Boulevard de la Lironde 34398 MONTPELLIER CEDEX 5, France tel : (33) 4 67 61 65 77 fax : (33) 4 67 61 56 68 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor