Re: list of tuples with dynamic change in position

2010-09-07 Thread Ulrich Eckhardt
sajuptpm wrote: > i want to find the loaded machine based on cpu and mem and desk > utilization by changing this order. > > I created a UI using that i can change the order of item in the tuple. > But the problem is asc and desc sorting How about only changing the order in which the elements are

Re: list of tuples with dynamic change in position

2010-09-07 Thread sajuptpm
On Sep 7, 1:16 pm, Ulrich Eckhardt wrote: > sajuptpm wrote: > > I have a list of tuples l = [((cpu_util,mem_util),(disk_util)), > > ((cpu_util,mem_util),(disk_util))] > > ie, l = [((30,50),(70)), ((50,20),(20))] > > > l.sort(key=lambda x:(-x[0][0], x[1][0])) > > # sorting cpu_util asc and disk_uti

Re: list of tuples with dynamic change in position

2010-09-07 Thread Ulrich Eckhardt
sajuptpm wrote: > I have a list of tuples l = [((cpu_util,mem_util),(disk_util)), > ((cpu_util,mem_util),(disk_util))] > ie, l = [((30,50),(70)), ((50,20),(20))] > > l.sort(key=lambda x:(-x[0][0], x[1][0])) > # sorting cpu_util asc and disk_util desc One thing here: Without knowing what special m

Re: list of tuples with dynamic change in position

2010-09-07 Thread Gerard Flanagan
On 7 Sep, 07:42, sajuptpm wrote: > More details > I have a list of tuples l = [((cpu_util,mem_util),(disk_util)), > ((cpu_util,mem_util),(disk_util))] > ie, l = [((30,50),(70)), ((50,20),(20))] > > l.sort(key=lambda x:(-x[0][0], x[1][0])) # sorting cpu_util asc and > disk_util desc > > suppose i c

Re: list of tuples with dynamic change in position

2010-09-07 Thread Peter Otten
sajuptpm wrote: > More details > I have a list of tuples l = [((cpu_util,mem_util),(disk_util)), > ((cpu_util,mem_util),(disk_util))] > ie, l = [((30,50),(70)), ((50,20),(20))] > > l.sort(key=lambda x:(-x[0][0], x[1][0])) # sorting cpu_util asc and > disk_util desc > > suppose i changed order th

Re: list of tuples with dynamic change in position

2010-09-06 Thread sajuptpm
More details I have a list of tuples l = [((cpu_util,mem_util),(disk_util)), ((cpu_util,mem_util),(disk_util))] ie, l = [((30,50),(70)), ((50,20),(20))] l.sort(key=lambda x:(-x[0][0], x[1][0])) # sorting cpu_util asc and disk_util desc suppose i changed order that is l = [((mem_util,cpu_util), (d

Re: list of tuples with dynamic change in position

2010-09-06 Thread Gerard Flanagan
sajuptpm wrote: I have a list of tuples l = [(('s','a'),(5,9)), (('u','w'),(9,2)), (('y','x'),(3,0))] and postion of values in the tuple change dynamicaly. I need a way to access correct value even if change in position. from itertools import starmap, izip, imap list(imap(dict, starmap(izip, d)

Re: list of tuples with dynamic change in position

2010-09-06 Thread Ulrich Eckhardt
sajuptpm wrote: > I need to change position of each values in the list and that dont > affect fuctions which are using this list. So you want to change the list's content but you don't want anyone to be able to detect the difference? That doesn't make sense. > I must have to use list of tuples. >

Re: list of tuples with dynamic change in position

2010-09-06 Thread sajuptpm
I have a list of tuples l = [(('s','a'),(5,9)), (('u','w'),(9,2)), (('y','x'),(3,0))] and postion of values in the tuple change dynamicaly. I need a way to access correct value even if change in position. -- http://mail.python.org/mailman/listinfo/python-list

list of tuples with dynamic change in position

2010-09-06 Thread sajuptpm
I have a list of tuples l = [(('s','a'),(5,9)), (('u','w'),(9,2)), (('y','x'),(3,0))] some functions using this list and fetch data using index l[0][1], l[1] [1] I need to change position of each values in the list and that dont affect fuctions which are using this list. I must have to use list of